I am having a problem using a Struct in one of my controllers. My code works fine in a standalone Ruby program and in IRB but fails in Rails.
Here's the code:
Result = Struct.new :status, :detail, :url
r = Result.new 'OK', 'Top banana', 'http://blah'
When that's executed in one of my actions, Rails give me this:
SyntaxError (/path/to/app/config/../app/controllers/store_controller.rb:79: dynamic constant assignment
Result = Struct.new(:status, :detail, :url)
[rest of trace snipped]
Any guidance would be much appreciated.
Thanks and regards,