Module: ModelManage::Metadata

Included in:
Mongoid::Relations::Metadata
Defined in:
lib/model_manage/mongoid_rails_erd.rb

Instance Method Summary collapse

Instance Method Details

#active_recordObject



6
7
8
# File 'lib/model_manage/mongoid_rails_erd.rb', line 6

def active_record
  form.owner
end

#belongs_to?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/model_manage/mongoid_rails_erd.rb', line 12

def belongs_to?
  [:referenced_in, :embedded_in].member? macro
end

#check_validity!Object



9
10
11
# File 'lib/model_manage/mongoid_rails_erd.rb', line 9

def check_validity!
  nil
end

#collection?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/model_manage/mongoid_rails_erd.rb', line 15

def collection?
  not belongs_to?
end

#optionsObject



3
4
5
# File 'lib/model_manage/mongoid_rails_erd.rb', line 3

def options
  form.data.merge(self)
end

#through_reflectionObject



18
19
20
# File 'lib/model_manage/mongoid_rails_erd.rb', line 18

def through_reflection
  active_record.relations[ form.options[:through].to_s ]
end