Module: Transcriber::Resource::Relation::Builder

Included in:
Builder
Defined in:
lib/transcriber/resource/key/relation/builder.rb

Instance Method Summary collapse

Instance Method Details

#belongs_to(name, options = {}) ⇒ Object



19
20
21
22
# File 'lib/transcriber/resource/key/relation/builder.rb', line 19

def belongs_to(name, options = {})
  options.merge!(many: false, has: false)
  relation(name, options)
end

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



14
15
16
17
# File 'lib/transcriber/resource/key/relation/builder.rb', line 14

def has_many(name, options = {})
  options.merge!(many: true, has: true)
  relation(name, options)
end

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



9
10
11
12
# File 'lib/transcriber/resource/key/relation/builder.rb', line 9

def has_one(name, options = {})
  options.merge!(many: false, has: true)
  relation(name, options)
end

#relation(name, options = {}) ⇒ Object



5
6
7
# File 'lib/transcriber/resource/key/relation/builder.rb', line 5

def relation(name, options = {})
  key Relation.new(name, options)
end