Sha256: f0012ae8c8e3836b1c49276de1fd72f6a4bccddab4726c01dc484f3787fdcdd3

Contents?: true

Size: 613 Bytes

Versions: 12

Compression:

Stored size: 613 Bytes

Contents

module Transcriber
  class Resource
    module Builder
      module Relations
        def relation(name, options = {})
          key Relation.new(name, options)
        end

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

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

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
transcriber-0.0.25 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.24 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.23 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.22 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.21 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.20 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.19 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.18 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.17 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.16 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.15 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.14 lib/transcriber/resource/builder/relations.rb