Hi.
I need to insert a note in my notes table in my mysql db, that is
related to my users table.
#user.rb
has_many :notes
#notes.rb
has_many :users
and i have a table called users_notes. That looks like this:
users_id
notes_id
How do i after saving a note (As under here), make the relation to the
users table?
def create
@notes = Notes.new(params[:notes])
if @notes.save
flash[:notice] = ‘Notes was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end
Thanks.
Emil T. Kampp