Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #4671

Ruby/Sinatra - Variable inside erb calls

From Scott Elwood <elwood32@live.com>
Newsgroups comp.lang.ruby
Subject Ruby/Sinatra - Variable inside erb calls
Date 2011-05-17 06:22 -0500
Organization Service de news de lacave.net
Message-ID <69d0c8c5a3b8782605829508018eef60@ruby-forum.com> (permalink)

Show all headers | View raw


Hi there,

I have a question regarding variables inside of erb arguments. This is
what I would like to achieve:




require 'sinatra'

get '/' do
     style = 'default'
     erb :'templates/'+style+'/layout'
end




Running that will give you errors, saying there can't be a plus sign for
the concatenation.

Is there a way to work around this?

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Ruby/Sinatra - Variable inside erb calls Scott Elwood <elwood32@live.com> - 2011-05-17 06:22 -0500
  Re: Ruby/Sinatra - Variable inside erb calls Scott Elwood <elwood32@live.com> - 2011-05-17 17:30 -0500

csiph-web