Module: Jacoat::Representable::ClassMethods

Defined in:
lib/jacoat/representable.rb

Instance Method Summary collapse

Instance Method Details

#has_many(name, options = {}, &block) ⇒ Object



36
37
38
# File 'lib/jacoat/representable.rb', line 36

def has_many(name, options = {}, &block)
  add_relationship(name, :_has_many, options, block)
end

#has_one(name, options = {}, &block) ⇒ Object



32
33
34
# File 'lib/jacoat/representable.rb', line 32

def has_one(name, options = {}, &block)
  add_relationship(name, :_has_one, options, block)
end


27
28
29
30
# File 'lib/jacoat/representable.rb', line 27

def link(link, &block)
  representable_attrs[:_link] = {} if representable_attrs[:_link].nil?
  representable_attrs[:_link][link] = block if block_given?
end


24
25
# File 'lib/jacoat/representable.rb', line 24

def links
end

#relationshipsObject



40
41
# File 'lib/jacoat/representable.rb', line 40

def relationships
end

#type(type) ⇒ Object



20
21
22
# File 'lib/jacoat/representable.rb', line 20

def type(type)
  representable_attrs[:_type] = type.to_s
end