accepts_nested_attributes_for with has_many => :through Options
Take a look at the line of your code
<% f.fields_for :tags_attributes do |tag_form| %>
You need to use just :tags
instead of :tags_attributes
.This will solve your issue
Make sure that You have build links and tags in your controller like
def new @link = @current_user.links.build @link.tags.buildend
I found this here on stackoverflow:
Rails nested form with has_many :through, how to edit attributes of join model?
please tell me if it worked.
In order for this to work, you need to pass in the right params hash:
params = { :link => { :tags_attributes => [ {:tag_one_attr => ...}, {:tag_two_attr => ...} ], :link_attr => ... }}
And your controller will look like:
def create @link = Link.create(params[:link]) # this will automatically build the rest for yourend