From: James Britt Date: 2006-01-08T06:33:51+09:00 Subject: Re: module_eval: create method that contains value passed to it? Henrik wrote: > This is a Rails example, but I think the problem is a general Ruby > matter. Perhaps, but it would be more helpful to isolate the problem by removing all Rails influence, since there is every chance that Rails is munging up core Ruby behavior. But I think the problem is simply that you are not quoting your strings correctly: class HelpController def self.foobar(v) class_eval %Q{ def get_foobar() "start #{v} end" end } end foobar "testing testing 123" def index puts "A " + get_foobar + " O" end end HelpController.new.index # A start testing testing 123 end O (Big Q, not little q) I have no idea if this works on the railroad. James -- http://www.ruby-doc.org - Ruby Help & Documentation http://www.artima.com/rubycs/ - Ruby Code & Style: Writers wanted http://www.rubystuff.com - The Ruby Store for Ruby Stuff http://www.jamesbritt.com - Playing with Better Toys http://www.30secondrule.com - Building Better Tools