Displaying 20 results from an estimated 400 matches similar to: "alias_method_chain vs. redefined method with super"
2009 Jan 20
0
alias_method_chain in Facebooker Causing Stack Level Too Deep
I installed the Facebooker plugin and upon placing it on a staging server, I
keep running into stack level too deep errors. It seems to stem from
Facebooker using alias_method_chain to override some of the
ActionController methods. I believe it''s getting loaded twice causing
confusion. I''ve tried various methods include wrapping a unless
respond_to?(:method) around the
2007 Apr 12
0
Does Ferret have problems with #alias_method_chain ?
Hi all,
I have this in my class:
class Party < AR::B
acts_as_ferret :store_class_name => true, :remote => true,
:fields => (self.content_columns.map(&:name) rescue []) +
%w(main_identifier)
class << self
# #count is also defined, omitted for clarity
def find_with_destroyed_scope(*args)
with_destroyed_scope do
2006 Aug 16
0
acts_as_paranoid and alias_method_chain
when i require acts_as_paranoid I''m getting: undefined method
`alias_method_chain'' for #<Class:ActiveRecord::Base> (NoMethodError)
It happens in acts_as_paranoid''s init.rb. here''s the whole file. the
alias_method_chain is near the bottom. please advise.
class << ActiveRecord::Base
def belongs_to_with_deleted(association_id, options = {})
2009 Oct 21
3
alias_method_chain and ActiveSupport::TestCase
I''m trying to add some functionality to the setup method of all my
tests.
I added a method called setup_with_ts in the test_helper and chained
it using alias_method_chain :setup, :ts and that works great for every
test that does not define setup in the test.
So for my unit tests i tried also defining the same method
setup_with_ts in a
class ActiveSupport::TestCase
def setup_with_ts
2007 Mar 22
0
`alias_method_chain': undefined method `find' for class `ActiveRecord::Base' (NameError)
I can''t seem to be able to override the :find method in the model base
class, for example, in /lib/usermonitor.rb:
module ActiveRecord
module UserMonitor
def self.included(base)
base.class_eval do
alias_method_chain :find, :user
def current_site
Thread.current[:user]
end
end
end
def find_with_user(*args)
...
end
end
2009 Dec 29
1
undefined method `alias_method_chain' for I18n::Backend::Simple:Class
Hi,
We are running RE:
ruby 1.8.7 (2009-06-12 patchlevel 174) [sparc-solaris2.10], MBARI
0x8770, Ruby Enterprise Edition 2009.10
I tried a simple web app with a controller rendering a text and is
working in my PC but on the server I get:
Error message:
undefined method `alias_method_chain'' for
I18n::Backend::Simple:Class
Exception class:
NoMethodError
Application root:
2007 Jun 12
1
alias_method_chain and Class methods (a Ruby question)
Hello list,
I am trying to override the post_form method of Net::HTTP so that it
does something before actually doing the post. I tried the following
in environments/development.rb
module Net
class HTTP
alias_method_chain :post_form, :intercept
def post_form_with_intercept(url, params)
# Do something before post
logger.info(''About to post at
2008 Mar 28
1
undefined method ''alias_method_chain''
Running Rails 2.0.2, I get this error:
./script/../config/../vendor/plugins/facebooker/lib/facebooker/rails/facebook_url_rewriting.rb:29:
undefined method `alias_method_chain'' for
ActionController::UrlRewriter:Class (NoMethodError)
from /usr/local/rubygems/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require''
from
2010 Jul 23
0
alias_method_chain with i18n
Hello,
I was investigating solutions for i18n with will_paginate and I found
a possible solution at http://lawrencesong.net/2009/01/enable-i18n-in-will_paginate-plugin/
The author adds to application_helper.rb the following code:
#############################################
include WillPaginate::ViewHelpers
def will_paginate_with_i18n(collection, options = {})
2007 Aug 30
1
alias_method_chain stack level too deep in Rake test only
I have an odd error. I have the following module:
module ActionController
module SslSupport
def self.included(base)
raise "#{base} does not define url_for" unless
base.method_defined?(:url_for)
unless base.respond_to?(:url_for_without_ssl_supprt)
base.send :include, InstanceMethods
base.send :alias_method_chain, :url_for, :ssl_support
end
2007 Sep 20
2
Rendering a partial from within that partial
I am having trouble rendering a partial called ''names'' through a submit
tag located within that partial. The form data is saving with my current
code. However, the existing data is not loading into the form and the
partial is not being re-rendered upon submission to reveal the changes
to this data.What might I do to fix this?
show.rhtml
<%= javascript_include_tag :defaults
2008 Nov 23
4
Strange behavior of alias_method_chains
Greetings.
I''ve got very strange behavior of alias_method_chains, and I hope
someone will advise me.
I have a rails 2.2.2 app created with
#rails aliasApp
, a class XYZ residing in app/helpers/xyz.rb:
<code>
class XYZ
attr_accessor :name
attr_accessor :value
def initialize (a, b)
puts "in XYZ constructor"
self.name = a
self.value = b
end
def a
2011 Apr 08
5
How to extend a helper using plugin?
Hello,
I''m facing this problem while trying to extend the parse_redmine_links
helper method in Redmine-1.1.0 (Rails-2.3.5) from my plugin.
My idea is to use alias_method_chain so the extended version could
call the original version and adjust the result to it''s liking.
Anything I''ve tried so far exposes this behavior: the first render of
a page uses the extended
2009 Aug 17
1
Problem with setter override on ActiveRecord
(This message was originally written on StackOverflow -- the
formatting is much prettier there --
http://stackoverflow.com/questions/1283046/problem-with-setter-override-on-activerecord)
This is not exactly a question, it''s rather a report on how I solved
an issue with write_attribute when the attribute is an object, on
Rails'' Active Record. I hope this can be useful to others
2008 Feb 01
0
non-pending spec returning pending
I''m speccing some code which monkey-patches initialize on
ActiveResource::Base. The monkey-patch lives in a module. My spec
looks like this:
describe MyModule, "doing stuff" do
it "adds methods to ARes subclasses" do
class Thing < ARes::Base ; end
(lambda {Thing.new.the_new_method}).should_not raise_error(NoMethodError)
end
end
I did this thing
2009 Sep 09
0
Rails 2.3.4 ActiveRecord association problem
Upgraded our app from Rails 2.2.2 to 2.3.4, and I''m now encountering
an error when adding a child to a parent.
Top of the stack:
wrong number of arguments (1 for 0)
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/
associations/has_many_association.rb:61:in `save''
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/
2008 Mar 03
0
A kind of monkey patch and an invitation for criticism for all you (who know this stuff better than I do)
I''ve often felt the need including Rails'' view helpers within my
controllers, if only for some simple things like formatting my flash
notices with text helpers or html escaping. I loved this suggestion,
which helps by not cluttering the namespace of controllers:
http://snippets.dzone.com/posts/show/1799
But I wanted to generalize this a little to automatically include
whatever
2006 Jul 02
0
Rails Core Weekly June 19 - July 2 2006
This is another edition of Rails Core Weekly, affectionately known as
RCW. A much nicer pre-web 3.0 version is available from the following
url :
http://www.pinupgeek.com/articles/category/rails-core-weekly-news
We have an Atom/RSS feed available there as well.
Rails Core Weekly summarizes the rails-core mailing list, a list
dedicated to Ruby on Rails internals and its development. RCW is
2006 Jun 15
1
Unicode hacks - problem
I have updated to latest Unicode hacks plugin and now it fails when
rails are started ....
C:\ruby_projects\radrails\workspace\auth_template>mongrel_rails start
** Starting Mongrel in development mode at 0.0.0.0:3000
** Starting Rails in environment development ...
C:/ruby_projects/radrails/workspace/auth_template/config/../vendor/plugins/scoped_access/init.rb:17:in
2009 May 06
1
How to extend ActionMailer
I wish to extend ActionMailer::Base by method chaining a class instance
variable:
module ActionMailer
class Base
class << self
def method_name
...
What is the magic incantation to accomplish this?
I cannot get this to work with action mailer:
module MyMethods
def self.include(base)
base.alias_method_chain :method_name, :my_method
def