Sha256: e2f63e26bbbdd489b256001a7080cc1c60c71459628da3acb4e21608bd25fe5a

Contents?: true

Size: 608 Bytes

Versions: 12

Compression:

Stored size: 608 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.13 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.12 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.11 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.10 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.9 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.8 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.7 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.6 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.5 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.4 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.3 lib/transcriber/resource/builder/relations.rb
transcriber-0.0.2 lib/transcriber/resource/builder/relations.rb