Skip to content

Instantly share code, notes, and snippets.

@lacco
Created December 3, 2009 23:34
Show Gist options
  • Save lacco/248673 to your computer and use it in GitHub Desktop.
Save lacco/248673 to your computer and use it in GitHub Desktop.
>> HistoryItem.new(:historytype => "Foo").valid?
Foo
[]
=> true
>> HistoryItem.new(:historytype => "Foo").valid?
Blub
["Foo"]
=> true
class HistoryItem < ActiveRecord::Base
cattr_accessor :types
@@types = []
validates_inclusion_of :historytype, :in => types
def after_initialize
puts "Called"
puts self.historytype
p @@types
@@types << self.historytype
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment