Class: MetaTypeProperty

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/meta_type_property.rb

Class Method Summary collapse

Instance Method Summary collapse

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(meta_type)
  meta_type_member = meta_type_members.where(meta_type_id: meta_type.id).first
  meta_type_member.position
end

#limitObject



66
# File 'app/models/meta_type_property.rb', line 66

def limit() nil end

#nameObject



41
# File 'app/models/meta_type_property.rb', line 41

def name() "#{label} (#{property_type_sid}) " end

#number?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'app/models/meta_type_property.rb', line 62

def number?
  %w{integer float}.member? property_type_sid
end

#property_typeObject



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!(meta_type, pos)
  meta_type_member = meta_type_members.where(meta_type_id: meta_type.id).first
  meta_type_member.position = pos
  meta_type_member.save!
end

#typeObject



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