I'm trying to use instance_eval in a project I'm doing, and I
extracted a very simple example:
class IETest
attr_accessor :foo
end
t = IETest.new
t.instance_eval { self.foo = 'foo' }
puts t.foo
This works as expected. However if I do
t.instance_eval { foo = 'foo' }
then t.foo => nil
I also know that t.instance_eval { @foo => 'foo' } would work in this
case. However, I'm trying to set a Rails attribute, so I have to go
through the method accessor. Is there any way that I can make this
work with just { foo = 'foo' } instead of { self.foo = 'foo' } ?
Pat