Kristian Mandrup
2010-Jan-27 16:42 UTC
Critical Rails 3 scaffold error - undefined method `to_sym'' for nil:NilClass
$ script/generate scaffold Post name:string index /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ruby/ 1.9.1/gems/activesupport-3.0.pre/lib/active_support/whiny_nil.rb:49:in `method_missing'': undefined method `to_sym'' for nil:NilClass (NoMethodError) from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/ generated_attribute.rb:7:in `initialize'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/named_base.rb: 52:in `new'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/named_base.rb: 52:in `block in parse_attributes!'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/named_base.rb: 50:in `map'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/named_base.rb: 50:in `parse_attributes!'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/named_base.rb: 22:in `initialize'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/ resource_helpers.rb:25:in `initialize'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/vendor/thor-0.12.3/lib/thor/ group.rb:35:in `new'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/vendor/thor-0.12.3/lib/thor/ group.rb:35:in `block in start'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/vendor/thor-0.12.3/lib/thor/ base.rb:354:in `start'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/vendor/thor-0.12.3/lib/thor/ group.rb:28:in `start'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators.rb:163:in `invoke'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/railties-3.0.pre/lib/rails/commands/generate.rb:10:in `<top (required)>'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/activesupport-3.0.pre/lib/active_support/ dependencies.rb:167:in `require'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/activesupport-3.0.pre/lib/active_support/ dependencies.rb:167:in `block in require'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/activesupport-3.0.pre/lib/active_support/ dependencies.rb:537:in `new_constants_in'' from /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ ruby/1.9.1/gems/activesupport-3.0.pre/lib/active_support/ dependencies.rb:167:in `require'' from script/generate:3:in `<main>'' I get this error in all the rails 3 applications I have so far created :( -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Anuj Dutta
2010-Jan-27 17:20 UTC
Re: Critical Rails 3 scaffold error - undefined method `to_sym'' for nil:NilClass
2010/1/27 Kristian Mandrup <kmandrup@gmail.com>> $ script/generate scaffold Post name:string index > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ruby/ > 1.9.1/gems/activesupport-3.0.pre/lib/active_support/whiny_nil.rb:49:in > `method_missing'': undefined method `to_sym'' for nil:NilClass > (NoMethodError) > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/ > generated_attribute.rb:7:in `initialize'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/named_base.rb: > 52:in `new'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/named_base.rb: > 52:in `block in parse_attributes!'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/named_base.rb: > 50:in `map'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/named_base.rb: > 50:in `parse_attributes!'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/named_base.rb: > 22:in `initialize'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators/ > resource_helpers.rb:25:in `initialize'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/vendor/thor-0.12.3/lib/thor/ > group.rb:35:in `new'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/vendor/thor-0.12.3/lib/thor/ > group.rb:35:in `block in start'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/vendor/thor-0.12.3/lib/thor/ > base.rb:354:in `start'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/vendor/thor-0.12.3/lib/thor/ > group.rb:28:in `start'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/generators.rb:163:in > `invoke'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/railties-3.0.pre/lib/rails/commands/generate.rb:10:in > `<top (required)>'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/activesupport-3.0.pre/lib/active_support/ > dependencies.rb:167:in `require'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/activesupport-3.0.pre/lib/active_support/ > dependencies.rb:167:in `block in require'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/activesupport-3.0.pre/lib/active_support/ > dependencies.rb:537:in `new_constants_in'' > from > /Users/kristianconsult/my_rails/rails3_apps/r3_test/vendor/gems/ > ruby/1.9.1/gems/activesupport-3.0.pre/lib/active_support/ > dependencies.rb:167:in `require'' > from script/generate:3:in `<main>'' > > I get this error in all the rails 3 applications I have so far > created :( > >I think you are using it incorrectly. Don''t you do this? script/generate scaffold Post name:string Anuj> -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com<rubyonrails-core%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > >-- Anuj DUTTA -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Kristian Mandrup
2010-Jan-27 18:32 UTC
Re: Critical Rails 3 scaffold error - undefined method `to_sym'' for nil:NilClass
Yes, for some reason it used to be that you would specify first the model/controller name, then the attributes of the model and then the actions of the generated controller. Now you can only specify controller/model and attributes for some reason. Still, scaffold doesn''t work at all with the rails3_datamapper project :( $ script/generate scaffold Post /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/activesupport/lib/active_support/ dependencies.rb:601:in `to_constant_name'': Anonymous modules have no name to be referenced by (ArgumentError) from /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/activesupport/lib/active_support/ dependencies.rb:407:in `qualified_name_for'' from /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/activesupport/lib/active_support/ dependencies.rb:115:in `rescue in const_missing'' .. Am I missing some inportant initialization step? $ bin/rake db:create (in /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3) Creating database ''rails3_development'' kristian-mandrups-macbook-pro:datamapper_on_rails3 kristianconsult$ bin/rake db:automigrate (in /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3) rake aborted! Anonymous modules have no name to be referenced by (See full trace by running task with --trace) kristian-mandrups-macbook-pro:datamapper_on_rails3 kristianconsult$ bin/rake db:automigrate --trace (in /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3) ** Invoke db:automigrate (first_time) ** Invoke db:load_models (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! Anonymous modules have no name to be referenced by /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/activesupport/lib/active_support/ dependencies.rb:601:in `to_constant_name'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/activesupport/lib/active_support/ dependencies.rb:407:in `qualified_name_for'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/activesupport/lib/active_support/ dependencies.rb:115:in `rescue in const_missing'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/activesupport/lib/active_support/ dependencies.rb:105:in `const_missing'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails3_datamapper/lib/rails3_datamapper/ railtie.rb:62:in `block in <class:Railtie>'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/railties/lib/rails/initializable.rb: 23:in `instance_exec'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/railties/lib/rails/initializable.rb: 23:in `run'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/railties/lib/rails/initializable.rb: 61:in `block in run_initializers'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/railties/lib/rails/initializable.rb: 60:in `each'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/railties/lib/rails/initializable.rb: 60:in `run_initializers'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/railties/lib/rails/application.rb: 63:in `initialize!'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/dirs/rails/railties/lib/rails/application.rb: 104:in `block in initialize_tasks'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'' /opt/local/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:in `each'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'' /opt/local/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:in `each'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'' /opt/local/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'' /Users/kristianconsult/my_rails/rails3_apps/datamapper_on_rails3/ vendor/gems/ruby/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top (required)>''bin/rake:3:in `load'' bin/rake:3:in `<main>'' kristian-mandrups-macbook-pro:datamapper_on_rails3 kristianconsult$ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.