Displaying 1 result from an estimated 1 matches for "member_subscriptions_attribut".
Did you mean:
member_subscriptions_attributes
2012 Jun 18
0
Creating an object with a nested has_many :through relationship
...ns an attribute called introduction. This works well.
Now, how can I create a Group with a nested subscription for the current
user who is filling in the form?
I have tried adding this to the Group model:
accepts_nested_attributes_for :member_subscriptions, :members
> attr_accessible :name, :member_subscriptions_attributes
In the new method of the Group controller I have this:
def new
> @group = Group.new
> @group.member_subscriptions.build
> end
So in the new template I added this:
<%= f.fields_for :member_subscriptions do |ms| %>
> <%= render partial: "group_membe...