Sha256: 68db3762e996873f4d1cbbb57bd5ad90309be04d44d28197ad47dfe45ecc92d6

Contents?: true

Size: 629 Bytes

Versions: 4

Compression:

Stored size: 629 Bytes

Contents

class Mg::GoalMetaType < ActiveRecord::Base
  set_table_name :mg_goal_meta_types
  
  belongs_to :mg_goal, :class_name => "Mg::Goal"
  has_many :gi_metas, :dependent => :destroy, :class_name => "Mg::GiMeta", :foreign_key => "mg_goal_meta_type_id" 
  has_many :gs_metas, :dependent => :destroy, :class_name => "Mg::GsMeta", :foreign_key => "mg_goal_meta_type_id"
  
  validates_presence_of :name
  validates_presence_of :var
  validates_presence_of :meta_type
  
  def meta
    case self.meta_type
    when 'gi_meta', 'ci_meta'
      return self.gi_metas
    when 'gs_meta', 'cs_meta'
      return self.gs_metas
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mountain-goat-1.0.5 lib/mountain-goat/models/mg/goal_meta_type.rb
mountain-goat-1.0.4 lib/mountain-goat/models/mg/goal_meta_type.rb
mountain-goat-1.0.3 lib/mountain-goat/models/mg/goal_meta_type.rb
mountain-goat-1.0.2 lib/mountain-goat/models/mg/goal_meta_type.rb