ruby - Rails scaffold strange undefined_method error for specific table -
i'm working on admin tool existing database , encountered strange problem when scaffolding particular table.
here schema of table using rake db:schema:dump
:
create_table "locality", :force => true |t| t.integer "version", :limit => 8, :null => false t.string "truth_id", :null => false t.string "truth_record_id", :null => false t.binary "deleted", :limit => 1, :null => false t.string "internal_code", :null => false t.string "iso_code" t.string "materialized_path", :null => false t.string "invariant_name", :null => false t.binary "published", :limit => 1, :null => false t.float "geo_point_latitude", :default => 0.0 t.float "geo_point_longitude", :default => 0.0 t.string "class", :null => false t.integer "hut_count", :default => 0 t.integer "hotel_count", :default => 0 t.string "destination_url" end add_index "locality", ["truth_record_id"], :name => "truth_record_id", :unique => true
i used schema_to_scaffold gem create scaffold dumped schema:
rails g scaffold locality version:integer truth_id:string truth_record_id:string deleted:binary internal_code:string iso_code:string materialized_path:string invariant_name:string published:binary geo_point_latitude:float geo_point_longitude:float class:string hut_count:integer hotel_count:integer destination_url:string
this workflow worked lot of other tables when accessing /localities or locality.all in rails console its:
irb(main):001:0> locality.all locality load (2.1ms) select `locality`.* `locality` nomethoderror: undefined method `attribute_method_matcher' "country":string
where "country":string come from? @ first thought model name 'locality' somehow reservers rails i18n stuff same problem happens when naming model 'bla'.
i'm using rails 3.2.13 , mysql database.
i believe column: class invalid. how have access column since class method of object in ruby?
i think causes mess. class column's value of loaded locality "country" right?