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





_______________________________________________
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to