Module: Fakecrm::Kinds
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fakecrm/resource/extensions/kinds.rb', line 9 def self.included(base) base.class_eval do property :kind, ::DataMapper::Property::String, :required => true validates_with_method :kind, :method => :check_kind def check_kind if CustomType.first(:name => self.kind, :kind => self.class.name.split('::').last) return true else return [false, "Custom type #{self.kind} not found"] end end end end |
Instance Method Details
#one_of_a_kind? ⇒ Boolean
6 7 8 |
# File 'lib/fakecrm/resource/extensions/kinds.rb', line 6 def one_of_a_kind? true end |