Named scope lambda string substitution problem

I have a complex named scope like the following.

named_scope :foo, lambda {|foo, bar|
foo.each do |d|
#foo = “this line doesn’t work #{s}”
baz = "something like this works " + s

bar.each do |b|

:conditions => {‘baz’ => 1}

It does some pre-processing to calculate the :conditions hash. The
weird bit is that I get a bizarre syntax error when I try to use
double quoted strings with substitutions. If I use a syntax such as
“A”+str+“B” it’s ok, but “A#{str}B” is a syntax error. Any thoughts?

I’ve tried to replicate it in pure ruby lambda functions but wasn’t
able to, leading me to think it may be related to the named scope.