I am trying to initialize a class variable as a hash when I create an instance of SomeClass but I keep getting an error. Somewhat new to ruby so any help would be appreciated. Thanks
class SomeClass < ActiveRecord::Base
attr_accessible :some_hash
serialize :some_hash, Hash
def initialize(args = {})
@some_hash != {}
end
end
NoMethodError: undefined method has_key?' for nil:NilClass
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/whiny_nil.rb:52:inmethod_missing'
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2827:in has_attribute?'inspect'
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2888:in
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2887:in collect'inspect'
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:2887:in
from /opt/local/lib/ruby/1.8/irb.rb:310:in output_value'eval_input'
from /opt/local/lib/ruby/1.8/irb.rb:159:in
from /opt/local/lib/ruby/1.8/irb.rb:271:in signal_status'eval_input'
from /opt/local/lib/ruby/1.8/irb.rb:155:in
from /opt/local/lib/ruby/1.8/irb.rb:154:in eval_input'start'
from /opt/local/lib/ruby/1.8/irb.rb:71:in
from /opt/local/lib/ruby/1.8/irb.rb:70:in catch'start'
from /opt/local/lib/ruby/1.8/irb.rb:70:in
from /opt/local/bin/irb:13