Hi, made 3 models Article (has_many :categories, :through => :publishes) Publish (belongs_to :articles, belongs_to :categories) Category (has_many :articles, :through => :publishes) then I tryed to fetch the category''s belong to articles and it made a wierd sql query... MysqlError? <http://dev.rubyonrails.org/wiki/MysqlError>: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near / at line 1: SELECT categories.* FROM categories, publishes WHERE (categories.id = publishes.category_id AND publishes.#<article:0xb77634cc>_id = 1) / look at "publishes.#<article:0xb77634cc>", so I changed has_many_through to work as it should just added owner.class.to_s instead of owner.to_s please check the diff in the link http://dev.rubyonrails.org/ticket/3177
David Heinemeier Hansson
2005-Dec-11 18:08 UTC
Re: #3177[PATCH] has_many_through doesn''t work
> just added owner.class.to_s instead of owner.to_sApplied. And added tests to verify the behavior. Thanks. -- David Heinemeier Hansson http://www.loudthinking.com -- Broadcasting Brain http://www.basecamphq.com -- Online project management http://www.backpackit.com -- Personal information manager http://www.rubyonrails.com -- Web-application framework
sorry, next time I will include the tests David Heinemeier Hansson wrote:>>just added owner.class.to_s instead of owner.to_s >> >> > >Applied. And added tests to verify the behavior. Thanks. >-- >David Heinemeier Hansson >http://www.loudthinking.com -- Broadcasting Brain >http://www.basecamphq.com -- Online project management >http://www.backpackit.com -- Personal information manager >http://www.rubyonrails.com -- Web-application framework >_______________________________________________ >Rails-core mailing list >Rails-core@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails-core > > >