Sha256: 04401c2e338273493d4c88aff239e90afe5e6ddeab21be9c91c6bdffcc046b39

Contents?: true

Size: 547 Bytes

Versions: 12

Compression:

Stored size: 547 Bytes

Contents

class RestModel
  class Relation
    module Builder
      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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rest_model-0.1.11 lib/rest_model/key/relation/builder.rb
rest_model-0.1.10 lib/rest_model/key/relation/builder.rb
rest_model-0.1.9 lib/rest_model/key/relation/builder.rb
rest_model-0.1.8 lib/rest_model/key/relation/builder.rb
rest_model-0.1.7 lib/rest_model/key/relation/builder.rb
rest_model-0.1.6 lib/rest_model/key/relation/builder.rb
rest_model-0.1.5 lib/rest_model/key/relation/builder.rb
rest_model-0.1.4 lib/rest_model/key/relation/builder.rb
rest_model-0.1.3 lib/rest_model/key/relation/builder.rb
rest_model-0.1.2 lib/rest_model/key/relation/builder.rb
rest_model-0.1.1 lib/rest_model/key/relation/builder.rb
rest_model-0.1.0 lib/rest_model/key/relation/builder.rb