Sha256: 7d2a73abb5656ed8a1d6b37d7c3cbb72654d11a0a8cdd3cade64ee9abd2a238a

Contents?: true

Size: 495 Bytes

Versions: 8

Compression:

Stored size: 495 Bytes

Contents

module GdatastoreMapper
  module Associations
    class HasMany

      attr_accessor :owner, :belonging

      def initialize(owner, belonging)
        @owner = owner
        @belonging = belonging
      end

      def belonging_klass
        @belonging.to_s.classify.constantize
      end

      def owner_attributes
        {
          (@owner.class.to_s.underscore + '_id') => @owner.id
        }
      end

      def belonging_id
        @belonging.to_s + '_id'
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gdatastore_mapper-0.1.8 lib/gdatastore_mapper/associations/has_many.rb
gdatastore_mapper-0.1.7 lib/gdatastore_mapper/associations/has_many.rb
gdatastore_mapper-0.1.6 lib/gdatastore_mapper/associations/has_many.rb
gdatastore_mapper-0.1.5 lib/gdatastore_mapper/associations/has_many.rb
gdatastore_mapper-0.1.4 lib/gdatastore_mapper/associations/has_many.rb
gdatastore_mapper-0.1.3 lib/gdatastore_mapper/associations/has_many.rb
gdatastore_mapper-0.1.2 lib/gdatastore_mapper/associations/has_many.rb
gdatastore_mapper-0.1.2bata lib/gdatastore_mapper/associations/has_many.rb