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 Tue, 17 May 2011 06:22:41 -0500
Organization Service de news de lacave.net
Lines 26
Message-ID <69d0c8c5a3b8782605829508018eef60@ruby-forum.com> (permalink)
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace talisker.lacave.net 1305637298 88557 65.111.164.187 (17 May 2011 13:01:38 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Tue, 17 May 2011 13:01:38 +0000 (UTC)
X-Received-From This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway
X-Mail-Count 383380
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <69d0c8c5a3b8782605829508018eef60@ruby-forum.com>
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!talisker.lacave.net!lacave.net!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:4671

Show key headers only | 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