Re: Accessing session variables

-- --
2006-11-15T04:13:52Z

Thanks for the reply. Neither of those seem to work. Here is my code
from the view:

<%= link_to_remote( "1", {:url => { :controller =>
"ratings", :action =>
"ratethis", :pageid => @page.id, :rateabletype =>
"xyz", :rating => 1}},
:class => ''one-star'', :name => ''1 star out of
5'') %>


Here is the action in the controller for adding the record to the
database. All fields are being inserted successfully except for the
userid field. As I mentioned earlier, I am storing the user ID value in
the session and simply need to use it here:


def ratethis
  @rating = Rating.new(:rating => params[:rating], :pageid =>
params[:pageid], :rateabletype => params[:rateabletype], :date=>
Time.now, :userid => NEEDTHIS)

  if @rating.save
    flash[:notice] = ''Rating was successfully created.''
    redirect_to :action => ''list''
  else
    render :action => ''new''
  end

end