Sha256: 02db1f93f03cf3c0dd7338f46bac3a57d3d15609e68c8d23e1babac06362561c

Contents?: true

Size: 600 Bytes

Versions: 54

Compression:

Stored size: 600 Bytes

Contents

module Locomotive::Steam
  module Models

    class HasManyAssociation < ReferencedAssociation

      def __load__
        key = :"#{@options[:inverse_of]}_id"

        # all the further queries will be scoped by the "foreign_key"
        @repository.local_conditions[key] = @entity._id

        # use order_by from options as the default one for further queries
        @repository.local_conditions[:order_by] = @options[:order_by] unless @options[:order_by].blank?

        # all the further calls (method_missing) will be delegated to @repository
        @repository
      end

    end

  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
locomotivecms_steam-1.8.0.alpha2 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.8.0.alpha1 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.7.1 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.7.0 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.6.1 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.6.0 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.6.0.rc1 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.6.0.beta1 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.5.3 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.5.2 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.5.1 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.5.0 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.5.0.rc1 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.5.0.rc0 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.5.0.beta3 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.5.0.beta2 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.5.0.beta1 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.4.1 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.4.0 lib/locomotive/steam/models/associations/has_many.rb
locomotivecms_steam-1.4.0.rc2 lib/locomotive/steam/models/associations/has_many.rb