I'm creating a lightweight app to create and display information for upcoming events. I have an Event class defined that takes an args hash as a parameter. The initialize method is defined below.
class Event < ActiveRecord::Base
def initialize(args={})
@what = args[:what]
@theme = args[:theme]
...
end
end
So far, so good. Then, in Rails Console, I define an args hash and try to create an instance of Event but get the following error.
[4] pry(main)> args = {what: 'what', theme: 'theme'}
=> {:what=>"what", :theme=>"theme"}
[5] pry(main)> Event.new(args)
=> #<Event not initialized>
This seems really straightforward but I'm having trouble figuring it out. Any help is appreciated.