Cisco Ri wrote:
Thanks for letting me know. In links/new, how would I go about
including the current user_id? The only way I know of would be a hidden
form element, and I would like to keep it all server side.
Restful Authentication has the notion of current_user, does it not?
Check in the authenticated_system.rb file in lib for a peek at some
methods you have available to you.
There's no need to know the current_user's id in the links controller's
new action, that just needs to manufacture an @link for the new.html.erb
You will need it for the create action in the links controller though.
@link = Link.new(params[:link])
@link.user_id = current_user.id
render :action => 'new'
# redirect to your login page?
# I'd actually defend this method with a before_filter, and get
# rid of this if logged_in? stuff