Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #4666
| X-FeedAbuse | http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109 |
|---|---|
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!nospam.fr.eu.org!talisker.lacave.net!lacave.net!not-for-mail |
| From | Eugen Ciur <ciur.eugen@gmail.com> |
| Newsgroups | comp.lang.ruby |
| Subject | Re: Ruby/Sinatra - Variable inside erb calls |
| Date | Tue, 17 May 2011 06:34:11 -0500 |
| Organization | Service de news de lacave.net |
| Lines | 31 |
| Message-ID | <7011113ad9646a11b7fef0900f1ee153@ruby-forum.com> (permalink) |
| References | <69d0c8c5a3b8782605829508018eef60@ruby-forum.com> |
| NNTP-Posting-Host | bristol.highgroove.com |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | talisker.lacave.net 1305635874 85829 65.111.164.187 (17 May 2011 12:37:54 GMT) |
| X-Complaints-To | abuse@lacave.net |
| NNTP-Posting-Date | Tue, 17 May 2011 12:37:54 +0000 (UTC) |
| In-Reply-To | <69d0c8c5a3b8782605829508018eef60@ruby-forum.com> |
| 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 | 383381 |
| X-Ml-Name | ruby-talk |
| X-Rubymirror | Yes |
| X-Ruby-Talk | <7011113ad9646a11b7fef0900f1ee153@ruby-forum.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.ruby:4666 |
Show key headers only | View raw
You are on the right track:
:~> $ irb
ruby-1.9.2-p0 > :"hello"+'world'
NoMethodError: undefined method `+' for :hello:Symbol
from (irb):1
from /home/eugenc/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in
`<main>'
ruby-1.9.2-p0 > x = "hello"+'world'
=> "helloworld"
ruby-1.9.2-p0 > :x
=> :x
ruby-1.9.2-p0 >
In your case ruby converted :'templates/' to symbol, then tried to
concatenate string to it, this is because ':' has higher priority then
'+' operator. Solution is
template_name = 'templates/'+style+'/layout'
erb template_name
(drop ':' operator, it is not necessary).
----
http://blog.eugen.co
--
Posted via http://www.ruby-forum.com/.
Back to comp.lang.ruby | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Ruby/Sinatra - Variable inside erb calls Eugen Ciur <ciur.eugen@gmail.com> - 2011-05-17 06:34 -0500 Re: Ruby/Sinatra - Variable inside erb calls 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-17 14:16 -0500
csiph-web