The following code gives me an error:
class_vars = [‘fruit’,‘cow’,‘coffee’].each do |class_var|
“#{class_var}”.classify.send(:find, 1 + rand(10))
end
The error message stack:
LocalJumpError: no block given
from (irb):34:in find' from (irb):33:in
each’
from (irb):33:in find' from (irb):33:in
send’
from (irb):33
from (irb):32:in `each’
from (irb):32
from :0
What I am trying to do here is, convert a string to an ActiveRecord
class and then send a AR method like find to it. But it doesn’t work.
I have all the classes defined.
Any idea why this is happening?