Hi guys.

How do you update nested attributes for one object of a
has_many :through relationship? So I have an entity model and this
model can have many fact_values. The difference between fact and
fact_value is that the latter has an extra value attribute. This is
because facts can be common among many entities, but each entity can
have its own unique value for a specific fact. So my models are the
following:

class Entity
  has_many :fact_values
  has_many :facts, :through => :fact_values
end

class FactValue
  belongs_to :entity
  belongs_to :fact
end

class Fact
  has_many :fact_values
  has_many :entities, :through => :fact_values
end

Now I've specified that Entity
accepts_nested_attributes_for :fact_values. But I want it to accept
nested attributes for a single (pre-defined) fact_value and update
only that fact_value. The way I'm going about it right now is to have
a virtual attribute in my Entity model representing that one
fact_value and update that fact_value in the entity controller. I'm
wondering if there is any automatic way to accomplish what I'm trying
to do?

Thanks!

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to