Sha256: 09259175dfcd0191e03d713e457deaed8718c0dd7a76075d2c14633f0128b010

Contents?: true

Size: 1022 Bytes

Versions: 1

Compression:

Stored size: 1022 Bytes

Contents

# -*- encoding : utf-8 -*-
module RademadeAdmin
  module Search
    module Conditions
      class Abstract

        attr_reader :params

        # @param params [Hash]
        # @param data_items [RademadeAdmin::Model::Info::DataItems]
        #
        def initialize(params, data_items)
          @params = params
          @data_items = data_items
        end

        def conditions
          @conditions ||= {
            :where => where,
            :order => order,
            :page => page,
            :per_page => per_page,
            :limit => limit
          }
        end

        def base_condition(model)
          # todo. deleted at?
          # We can't use default scope. It can be patched
          model.unscoped
        end

        protected

        def where
          nil
        end

        def order
          nil
        end

        def page
          nil
        end

        def per_page
          nil
        end

        def limit
          nil
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rademade_admin-0.1.0 app/services/search/conditions/abstract.rb