Hi All,
I have a problem using has_many through association. I can create a product without problem, but when i edit it, i got this NoMethodError:
undefined method `reciters=' for #<Product:0xb71a77e8>
Did i miss something to code? I provided the codes below. Please help
Thanks,
Dida
product_controller.rb
Hi All,
I have a problem using has_many through association. I can create a product
without problem, but when i edit it, i got this NoMethodError:
undefined method `reciters=' for #<Product:0xb71a77e8>
Did i miss something to code? I provided the codes below. Please help
has_many :through doesn't have foos= before rails 2.1
Fred
Would you explain your answer a bit more? How come i can create a record without the error as i got when i was trying to update it? Any reference? Other solution to use instead?
Thanks,
Adinda P
> has_many :through doesn't have foos= before rails 2.1
Would you explain your answer a bit more? How come i can create a record
without the error as i got when i was trying to update it? Any reference?
Other solution to use instead?
Pretty much what I said. if you have has_many :customers you can do
customers= ..., but if you have has_many :customers, :through
=> :something_else, then until 2.1 you can't do it. It's just not
implemented (you'll have to do it yourself using the methods that are
available - the documentation on associations has a table of which
association types have which methods).
Fred
Pretty much what I said. if you have has_many :customers you can do
customers= …, but if you have has_many :customers, :through
=> :something_else, then until 2.1 you can’t do it. It’s just not
implemented (you’ll have to do it yourself using the methods that are
available - the documentation on associations has a table of which
association types have which methods).
I tried with @product.reciter_ids = params[:reciters] before and i also got NoMethodError. Please help.
unless params[:reciters].blank?
@product.reciters = Qori.find(params[:reciters])
end
Thanks,
Adinda P
Pretty much what I said. if you have has_many :customers you can do
customers= ..., but if you have has_many :customers, :through
=> :something_else, then until 2.1 you can't do it. It's just not
implemented (you'll have to do it yourself using the methods that are
available - the documentation on associations has a table of which
association types have which methods).
I tried with @product.reciter_ids = params[:reciters] before and i
also got NoMethodError. Please help.
foo_ids= doesn't exist either. You need to use <<, delete etc... (or
upgrade to 2.1)
Fred