I''m getting a nasty NoMethodError when running the scaffold generator
on a
Rails 3.0.3 project that was upgraded from a Rails 2 project. The following
command works fine on a *new* Ralis 3.0.3 project:
rails g scaffold variant_location name:string description:string
code:string
...but fails for an existing project with the error:
invoke active_record
create db/migrate/20101220190429_create_variant_locations.rb
identical app/models/variant_location.rb
invoke test_unit
identical test/unit/variant_location_test.rb
identical test/fixtures/variant_locations.yml
route resources :variant_locations
invoke scaffold_controller
(erb):5:in `template'': undefined method `all'' for
ActiveModel:Module
(NoMethodError)
from
/Users/preston/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/erb.rb:753:in
`eval''
from
/Users/preston/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/erb.rb:753:in
`result''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:111:in
`block in template''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in
`call''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in
`render''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:47:in
`identical?''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:73:in
`on_conflict_behavior''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:111:in
`invoke_with_conflict_check''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:61:in
`invoke!''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions.rb:95:in
`action''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/create_file.rb:26:in
`create_file''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:110:in
`template''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb:14:in
`create_controller_files''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/task.rb:22:in
`run''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:118:in
`invoke_task''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`block in invoke_all''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`each''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`map''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`invoke_all''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:226:in
`dispatch''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:109:in
`invoke''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:269:in
`block in _invoke_for_class_method''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/shell.rb:74:in
`with_padding''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:258:in
`_invoke_for_class_method''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:150:in
`_invoke_from_option_scaffold_controller''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/task.rb:22:in
`run''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:118:in
`invoke_task''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`block in invoke_all''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`each''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`map''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/invocation.rb:124:in
`invoke_all''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/group.rb:226:in
`dispatch''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.6/lib/thor/base.rb:389:in
`start''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/generators.rb:163:in
`invoke''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands/generate.rb:10:in
`<top (required)>''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`block in require''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in
`block in load_dependency''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in
`new_constants_in''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in
`load_dependency''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require''
from
/Users/preston/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:17:in
`<top (required)>''
from script/rails:6:in `require''
from script/rails:6:in `<main>''
Actually, *every* "generate scaffold" command fails in this app,
leading me
to believe that something in my custom code (or one of the libraries) is
causing it to explode. Unfortunately I have no idea what the issue is.
Ideas?
Preston
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Rafal Wrzochol
2010-Dec-29 00:01 UTC
Re: Rails 3.0.3 Generator NoMethodError On Existing Project
Have the same issue with native rails 3 application (ruby 1.9.2) Are you using ''railroady'' gem? Removing this gem from Gemfile seems to solve the problem for me. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Preston Lee
2010-Dec-29 00:09 UTC
Re: Rails 3.0.3 Generator NoMethodError On Existing Project
I haven''t had any luck. Does anyone else here have suggestions/hints? This is an extremely frustrating issue. :/ -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Dec-29 08:30 UTC
Re: Re: Rails 3.0.3 Generator NoMethodError On Existing Project
On 29 December 2010 00:09, Preston Lee <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I haven''t had any luck. Does anyone else here have suggestions/hints? > This is an extremely frustrating issue. :/Try removing all non-standard gems from your Gemfile, run bundle install and try the generate again. If that works (it may not but at least you have ruled out one possibility) then add them back in till you find the one that is causing the problem. Colin -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.