From: Eugen Ciur Date: 2011-05-17T20:34:11+09:00 Subject: Re: Ruby/Sinatra - Variable inside erb calls 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 `
' 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/.