This project is archived and is in readonly mode.
Model associations are trying to select singular table names after 3.0.5 upgrade
-
Everton Moreth
Same with me...
Here is some backtrace info:
57) Topico deve saber quando a ultima resposta foi atualizada Failure/Error: Unable to find matching line from backtrace Mysql::Error: Table 'myproject_test.resposta' doesn't exist # /home/emoreth/.rvm/gems/ruby-1.8.7-p330@myproject/gems/activerecord-3.0.5/lib/active_record/connection_adapters/mysql_adapter.rb:287:in `query' # /home/emoreth/.rvm/gems/ruby-1.8.7-p330@myproject/gems/activerecord-3.0.5/lib/active_record/connection_adapters/mysql_adapter.rb:287:in `execute' # /home/emoreth/.rvm/gems/ruby-1.8.7-p330@myproject/gems/activerecord-3.0.5/lib/active_record/connection_adapters/mysql_adapter.rb:438:in `columns' # /home/emoreth/.rvm/gems/ruby-1.8.7-p330@myproject/gems/activerecord-3.0.5/lib/active_record/base.rb:679:in `columns' # /home/emoreth/.rvm/gems/ruby-1.8.7-p330@myproject/gems/activerecord-3.0.5/lib/active_record/fixtures.rb:680:in `has_primary_key_column?' # /home/emoreth/.rvm/gems/ruby-1.8.7-p330@myproject/gems/activerecord-3.0.5/lib/active_record/fixtures.rb:599:in `insert_fixtures' # /home/emoreth/.rvm/gems/ruby-1.8.7-p330@myproject/gems/activerecord-3.0.5/lib/active_record/fixtures.rb:582:in `each' # /home/emoreth/.rvm/gems/ruby-1.8.7-p330@myproject/gems/activerecord-3.0.5/lib/active_record/fixtures.rb:582:in `insert_fixtures' # /home/emoreth/.rvm/gems/ruby-1.8.7-p330@myproject/gems/activerecord-3.0.5/lib/active_record/fixtures.rb:526:in `create_fixtures' # /home/emoreth/.rvm/gems/ruby-1.8.7-p330@myproject/gems/activerecord-3.0.5/lib/active_record/fixtures.rb:526:in `each' # /home/emoreth/.rvm/gems/ruby-1.8.7-p330@myproject/gems/activerecord-3.0.5/lib/active_record/fixtures.rb:526:in `create_fixtures'Table name on select should be "respostas".
Regards,
EMoreth -
joshfng
Any update on what's causing this?
-
joshfng
- Assigned user set to Aaron Patterson
Thanks to the guys in IRC we have tracked it down to this commit: https://github.com/rails/rails/commit/1754bd9b208e8d9207c226d1ffb3c...
My rails generated model was ImageMeta with a table name image_metas. Not it's trying to select image_meta
-
joshfng
- Assigned user changed from Aaron Patterson to Santiago Pastorino
-
Santiago Pastorino
- State changed from new to open
- Milestone set to 3.0.6
- Importance changed from to Low
-
Dan Pickett
I'm not sure how this is a bug as it relates to English word forms.
image_meta is a poor model name because meta is not a noun and does not have a plural form.
Arguably, there should be some locale based defaults for inflections to resolve Everton's issue, but I think the pluralization rules for English words are proper.
Josh, if you have to use the image_metas table name you could always add a custom inflection to get the behavior you want.
-
joshfng
Yes I ended up adding an inflector to change meta back to meta. It was poor model naming on my part but also affected other devs so I figured I would keep the ticket open.
-
Santiago Pastorino
- State changed from open to invalid
I agree with Dan here, anyways was not a good idea to push this to stable my fault :(.
Please use your own inflections to fix the problem.