I am logging users in and keeping them in session. The problem I am
having is showing only a certain logged in user’s information.
In the Adverts_Controler:
@advert = Advert.find(params[:id])
I am also having issues with saving an advert for an user:
@advert = Advert.new(params[:advert])
flash[:notice] = ‘Advert was successfully created.’
redirect_to :action => ‘list’
render :action => ‘new’
How do I get the user_id from the session and use it in above functions
to only show users’s adverts and to pass user_id to the create function
to create an advert for the logged in user?