[Rails] Update data in has_and_belongs_to_many
Hello, I have my model Email and Group.
I have the migration CreateEmailsGroupsJoin
create_table :emails_groups, :id => false do |t|
t.references :email
t.references :group
end
And in my email_controller, I make a update for my data, but I can't
change the value of my group_id, in the migration. I can change the
values on email data only.
@email = Email.find( params[ :id ] )
if @email.update_attributes( params[ :email ] )
flash[ :notice ] = ""
redirect_to :action => "list"
else
render "edit"
end
I want to know where I change in this code above to edit my group too.
Thanks
--
Posted via http://www.ruby-forum.com/.
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home