I have a many-to-many relationship between two models, Lists and Users.
When a user creates a list, it should automatically add it to the User.lists array. Right now, I have this working but it smells a bit:
def create
@list = current_user.lists.new(params[:list])
current_user.lists << @list
Is there a way to get this down to one line? Not passing @list into the collection with << but have it there automatically when I build the new list?
Thanks
You just have to do this :