Sha256: e2a17d1e24574414575babd23a88ed09054042488284d41da2ce5b0e77e3a69b

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

module Goldiloader
  class AssociationInfo

    def initialize(association)
      @association = association
    end

    if ActiveRecord::VERSION::MAJOR >= 4
      def read_only?
        @association.association_scope.readonly_value.present?
      end

      def offset?
        @association.association_scope.offset_value.present?
      end

      def limit?
        @association.association_scope.limit_value.present?
      end

      def from?
        @association.association_scope.from_value.present?
      end

      def group?
        @association.association_scope.group_values.present?
      end
    else
      def read_only?
        @association.options[:readonly].present?
      end

      def offset?
        @association.options[:offset].present?
      end

      def limit?
        @association.options[:limit].present?
      end

      def from?
        @association.options[:finder_sql].present?
      end

      def group?
        @association.options[:group].present?
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
goldiloader-0.0.4 lib/goldiloader/association_info.rb