In Model-1 scaffold create action,
def create
@auclub = Auclub.new(auclub_params)
user = User.find(current_user.id)
respond_to do |format|
if @auclub.save && user.update(auclub_id: @auclub.id)
format.html { redirect_to @auclub, notice: 'Auclub was successfully created.' }
format.json { render :show, status: :created, location: @auclub }
else
//some codes
end
end
end
and and i want create club with user
this code works, but if i use like this
user = User.find(current_user.id)
user.new(auclub_id : @auclub.id)
user.save
it doesn't works! is there any differences between update and new.save?