Class: MetaTypeProperty
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- MetaTypeProperty
- Defined in:
- app/models/meta_type_property.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get_position_for(meta_type) ⇒ Object
- #limit ⇒ Object
- #name ⇒ Object
- #number? ⇒ Boolean
- #property_type ⇒ Object
- #set_position_for!(meta_type, pos) ⇒ Object
- #type ⇒ Object
Class Method Details
.[](sid) ⇒ Object
71 |
# File 'app/models/meta_type_property.rb', line 71 def [](sid) find_by_sid(sid); end |
Instance Method Details
#get_position_for(meta_type) ⇒ Object
53 54 55 56 |
# File 'app/models/meta_type_property.rb', line 53 def get_position_for() = .where(meta_type_id: .id).first .position end |
#limit ⇒ Object
66 |
# File 'app/models/meta_type_property.rb', line 66 def limit() nil end |
#name ⇒ Object
41 |
# File 'app/models/meta_type_property.rb', line 41 def name() "#{label} (#{property_type_sid}) " end |
#number? ⇒ Boolean
62 63 64 |
# File 'app/models/meta_type_property.rb', line 62 def number? %w{integer float}.member? property_type_sid end |
#property_type ⇒ Object
43 44 45 |
# File 'app/models/meta_type_property.rb', line 43 def property_type MetaTypes::MetaPropertyType[property_type_sid] end |
#set_position_for!(meta_type, pos) ⇒ Object
47 48 49 50 51 |
# File 'app/models/meta_type_property.rb', line 47 def set_position_for!(, pos) = .where(meta_type_id: .id).first .position = pos .save! end |
#type ⇒ Object
58 59 60 |
# File 'app/models/meta_type_property.rb', line 58 def type {integer: :numeric}[property_type_sid.to_sym] || property_type_sid.to_sym end |