I've got a Wine
model, and a wine can have many Varietals
.
I have a WineVarietals
model and join the Wines to Varietals through that table.
When I put accepts_nested_attributes_for :wine_varietals
in my model, I get
No association found for name
wine_varietals'. Has it been defined yet?`
But I do have the association in my model.
My Wine model is
class Wine < ActiveRecord::Base attr_accessible :name, :winery_id, :wine_varietals_attributes accepts_nested_attributes_for :wine_varietals belongs_to :winery has_many :wine_varietals #has_and_belongs_to_many :varietals, :join_table => :wine_varietals has_many :wine_photos has_many :vintages
I also have WineVarietal and Varietal models.
If I comment out the accepts_nested_attributes_for
line, the error goes away.
I've tried different forms of pluralization wines_varietals
, wine_varietal
but can't seem to get rid of this error.