Re: Accessing session variables

rosoft2001
2006-11-15T04:30:56Z

This is not the a session variable, is a request variable:

I can''t try right now, but you should pass userid in the link_to_remote

, :name => ''1 star out of 5'', userid =>
''33''

then you read it with params[:userid]


Zon
http://www.ZONator.com



-- -- wrote:
> 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
>
> --
> Posted via http://www.ruby-forum.com/.