[Rails] Re: Rails 3.0.5 has been released!
Is anyone seeing odd errors with 3.0.5? I am seeing odd behavior
between 3.0.3 and 3.0.5. Namely, this statement...
site.featured_medias.where(:media_type => media_class, :unfeatured_at
=> nil).order("created_at desc").first
... works in 3.0.3, but produces this bad SQL in 3.0.5....
Mysql::Error: Table 'remix3_development.featured_media' doesn't exist:
SELECT `featured_media`.* FROM `featured_media` WHERE
`featured_media`.`media_type` = 'Message' AND
`featured_media`.`unfeatured_at` IS NULL AND (`featured_media`.site_id
= 1) ORDER BY created_at desc LIMIT 1
Note the table name is not pluralized. In my case, Site
has_many :featured_medias
FeaturedMedia does include a class method named featured_media, ala...
class FeaturedMedia < ActiveRecord::Base
...
def self.featured_media(site, media_class)
...
end
end
and the .where above is called within FeaturedMedia.featured_media.
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home