Rails undefined method 'generated_methods' for nil:NilClass

Posted by mike on Stack Overflow See other posts from Stack Overflow or by mike
Published on 2011-01-16T19:48:41Z Indexed on 2011/01/16 19:53 UTC
Read the original article Hit count: 339

Filed under:

Okay so I was just starting this rails app and generated my first model

ruby script/generate model Grid req:string class:string ctitle:string credits:float grade:string pass:boolean

created my table

rake db:migrate (in C:/Users/Michael/InstantRails/rails_apps/studentGrid) == CreateGrids: migrating ==================================================== -- create_table(:grids) -> 0.0150s == CreateGrids: migrated (0.0150s) ===========================================

and went to the console to add some data to my table

Grid => Grid(id: integer, req: string, class: string, ctitle: string, credits: float, grade: string, pass: boolean, created_at: datetime, updated_at: datetime) Grid.create(:req=>"Math Elective", :class=>"Math 111", :ctitle=>"Calculus I", :credits=>3.0)

Pretty standard I thought, but then I get this error and I don't understand why

NoMethodError: undefined method 'generated_methods' for nil:NilClass from C:/Users/Michael/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesup port-2.3.5/lib/active_support/whiny_nil.rb:52:inmethod_missing' from C:/Users/Michael/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerec ord-2.3.5/lib/active_record/attribute_methods.rb:352:in respond_to?' from C:/Users/Michael/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerec ord-2.3.5/lib/active_record/base.rb:2746:inattributes=' from C:/Users/Michael/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerec ord-2.3.5/lib/active_record/base.rb:2742:in each' from C:/Users/Michael/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerec ord-2.3.5/lib/active_record/base.rb:2742:inattributes=' from C:/Users/Michael/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerec ord-2.3.5/lib/active_record/base.rb:2438:in initialize' from C:/Users/Michael/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerec ord-2.3.5/lib/active_record/base.rb:721:innew' from C:/Users/Michael/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerec ord-2.3.5/lib/active_record/base.rb:721:in `create' from (irb):2 from :0

© Stack Overflow or respective owner

Related posts about ruby-on-rails