[markaby] Trouble accessing session values

Evaluating session variables inside a markaby paragraph tag always
returns
false. For example

welcome.mab

p “Good morning Mr. #{session[:user]}.”


displays:
Good mornig Mr.

How can I access session variables in maraby?

try #{helpers.session[:user]}

I think that’s the proper syntax.

Yes, that worked! I’m a happy coder, again :slight_smile:

One nagging question remain, though. How can I tell when to use the
'helpers.* syntax?
-Larry

I’m not actively using Markaby yet, though I’m about to. So, I’m not
much of an authority. :wink:

There’s some info on the redhanded website. If you google it, you’ll
find some info. I think the api docs are decent as well.

Jamie

Larry K. wrote:

Evaluating session variables inside a markaby paragraph tag always
returns
false. For example

welcome.mab

p “Good morning Mr. #{session[:user]}.”


displays:
Good mornig Mr.

How can I access session variables in maraby?

Fixed by patch in Markaby ticket 51
http://code.whytheluckystiff.net/markaby/ticket/51 which allows
session[] and params[] to be accessed without any qualifiers (just like
the other helpers). I verified this patch on Rails 1.2.1, Ruby 1,8.5,
Markaby 0.5.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs