@user = current_user() #returns a new object of the collection type that has been
instantiated with attributes and linked to this object through the
join table but has not yet been saved. @user.outlets.build(params[:outlet]) @user.save!
@user = current_user() #returns a new object of the collection type that has been
instantiated with attributes and linked to this object through the
join table @user.outlets.create(params[:outlet])
@user = current_user() #adds one or more objects to the collection by creating associations
in the join table @user.outlets << Outlet.new(params[:outlet])
@user = current_user() #returns a new object of the collection type that has been
instantiated with attributes and linked to this object through the
join table but has not yet been saved. @user.outlets.build(params[:outlet]) @user.save!
@user = current_user() #returns a new object of the collection type that has been
instantiated with attributes and linked to this object through the
join table @user.outlets.create(params[:outlet])
@user = current_user() #adds one or more objects to the collection by creating associations
in the join table @user.outlets << Outlet.new(params[:outlet])
and you’re getting that error, it means that @user is nil. Make sure
that current_user() actually returns a valid user before attempting to
add outlets to them.
Adam
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.