class Locomotive::Steam::Liquid::Tags::SessionAssign
Assign sets a variable in your session.
{% session_assign foo = 'monkey' %}
You can then use the variable later in the page.
{{ session.foo }}
Constants
- Syntax
Public Class Methods
new(tag_name, markup, options)
click to toggle source
Calls superclass method
# File lib/locomotive/steam/liquid/tags/session_assign.rb, line 18 def initialize(tag_name, markup, options) if markup =~ Syntax @to, @from = $1, $2 else raise ::Liquid::SyntaxError.new("Valid syntax: session_assign [var] = [source]") end super end
Public Instance Methods
render(context)
click to toggle source
# File lib/locomotive/steam/liquid/tags/session_assign.rb, line 28 def render(context) request = context.registers[:request] request.session[@to.to_sym] = context[@from] '' end