I have reduced the problem down to the following: whatever method I
define in the lib directory under active_record_extensions.rb, is not
being loaded by rails. This has worked perfectly for me in a large
Rails 2.1.0 application. So here is the problem:
RAILS_ROOT/lib/active_record_extensions.rb:
module ActiveRecord
class Base
class << self
def hello
puts "Hello from active record"
end
end
end
end
I start the server. I load Rails Console and try to invoke hello method
on any model class. I get exactly the same error as shown below on
Pizza class for example:
brupa...@bcr-d810:~/exp/pizzeria-3$ ruby ./script/console
Loading development environment (Rails 2.1.2)
>> Pizza.hello
NoMethodError: undefined method `hello' for #<Class:0xb784607c>
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:1672:in
`method_missing_without_paginate'
from
/home/bruparel/exp/pizzeria-3/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:170:in
`method_missing'
from (irb):1
>> CrustType.hello
NoMethodError: undefined method `hello' for #<Class:0xb72087dc>
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:1672:in
`method_missing_without_paginate'
from
/home/bruparel/exp/pizzeria-3/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:170:in
`method_missing'
from (irb):2
Does anyone know what is going on?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---