RoR sessions

Hello, how do I access session values from a view in Rails? I have tried <%=
#{@session[:user].userid'} but this causes a Rails error when it tries to
render the View. How do I code this correctly?

Thanks much
Ken
kenfettig@btinet.net

Ken Fettig napisał(a):

Hello, how do I access session values from a view in Rails? I have tried <%=
#{@session[:user].userid'} but this causes a Rails error when it tries to
render the View. How do I code this correctly?

Thanks much
Ken
kenfettig@btinet.net

I have no becouse I'am at work now and can not check it.

1) all code that is between <% %> is just a ruby code
so <%=session[:user].userid%> would be better idea

2) #{@session[:user].userid' - what is ' on the end of line - this for
sure will give you and error

3) #{some_value} this one you use only inside string so
<%
years=10
%>
<p>#{years.to_s}</p>

Cheers, Jacek
P.S. I see that you should read a little bit more about eruby.

Thank you very much for the help. Could you point me to some good info on
eruby?

Thanks again
Ken

"balcer" <balcersk@wsisiz.edu.pl> wrote in message
news:dg3o0j$pcg$1@portraits.wsisiz.edu.pl...

···

Ken Fettig napisa³(a):

Hello, how do I access session values from a view in Rails? I have tried
<%=
#{@session[:user].userid'} but this causes a Rails error when it tries to
render the View. How do I code this correctly?

Thanks much
Ken
kenfettig@btinet.net

I have no becouse I'am at work now and can not check it.

1) all code that is between <% %> is just a ruby code
so <%=session[:user].userid%> would be better idea

2) #{@session[:user].userid' - what is ' on the end of line - this for
sure will give you and error

3) #{some_value} this one you use only inside string so
<%
years=10
%>
<p>#{years.to_s}</p>

Cheers, Jacek
P.S. I see that you should read a little bit more about eruby.