I have these classes: class FilmTitle < ActiveRecord::Base has_many :films_film_titles has_many :films, :through => :films_film_titles has_many :assets, :through => :films end class Film < ActiveRecord::Base has_many :assets end class FilmsFilmTitle < ActiveRecord::Base belongs_to :film belongs_to :film_title end class Asset < ActiveRecord::Base belongs_to :film end but this does not work: ft = FilmTitle.find 13 ft.assets <- throws error: ActiveRecord::StatementInvalid: Mysql::Error: Unknown column ''films.film_title_id'' in ''where clause'': SELECT `assets`.* FROM `assets` INNER JOIN films ON assets.film_id = films.id WHERE ((`films`.film_title_id = 13)) How can I get to these? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 3, 6:50 pm, phil <p...-o0Q4Q1ys/oVBDgjK7y7TUQ@public.gmane.org> wrote:> I have these classes: > > class FilmTitle < ActiveRecord::Base > has_many :films_film_titles > has_many :films, :through => :films_film_titles > has_many :assets, :through => :films > endLast I heard, nested has many throughs like this weren''t supported. Fred> > class Film < ActiveRecord::Base > has_many :assets > end > > class FilmsFilmTitle < ActiveRecord::Base > belongs_to :film > belongs_to :film_title > end > > class Asset < ActiveRecord::Base > belongs_to :film > end > > but this does not work: > > ft = FilmTitle.find 13 > ft.assets <- throws error: > ActiveRecord::StatementInvalid: Mysql::Error: Unknown column > ''films.film_title_id'' in ''where clause'': SELECT `assets`.* FROM > `assets` INNER JOIN films ON assets.film_id = films.id WHERE > ((`films`.film_title_id = 13)) > > How can I get to these?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
Well that''s a drag. The SQL is easy... but I was hoping to make a named_scope. On Dec 3, 10:40 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Dec 3, 6:50 pm, phil <p...-o0Q4Q1ys/oVBDgjK7y7TUQ@public.gmane.org> wrote: > > > I have these classes: > > > class FilmTitle < ActiveRecord::Base > > has_many :films_film_titles > > has_many :films, :through => :films_film_titles > > has_many :assets, :through => :films > > end > > Last I heard, nested has many throughs like this weren''t supported. > > Fred > > > > > class Film < ActiveRecord::Base > > has_many :assets > > end > > > class FilmsFilmTitle < ActiveRecord::Base > > belongs_to :film > > belongs_to :film_title > > end > > > class Asset < ActiveRecord::Base > > belongs_to :film > > end > > > but this does not work: > > > ft = FilmTitle.find 13 > > ft.assets <- throws error: > > ActiveRecord::StatementInvalid: Mysql::Error: Unknown column > > ''films.film_title_id'' in ''where clause'': SELECT `assets`.* FROM > > `assets` INNER JOIN films ON assets.film_id = films.id WHERE > > ((`films`.film_title_id = 13)) > > > How can I get to these?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---