Sha256: 65708ca3bcbba77adbf3d460fe1e57ed871bc5cce4dbff88cc745233879bc1ea

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

Stored size: 971 Bytes

Contents

require 'ar_finder_form'
module ArFinderForm
  module ClientInstanceMethods
    def find_options(value = nil)
      @find_options = value if value
      @find_options ||= self.class.find_options.dup
      @find_options
    end

    def paginate_options(value = nil)
      @find_options = value if value
      @find_options ||= self.class.paginate_options.dup
      @find_options
    end

    def to_find_options(options = {})
      context = Context.build(self, options)
      context.to_find_options
    end

    def to_paginate_options(options = {})
      context = Context.build(self, options)
      context.to_paginate_options
    end

    def find(*args)
      options = to_find_options(args.extract_options!)
      args << options
      self.class.builder.model_class.find(*args)
    end

    def paginate(*args)
      options = to_paginate_options(args.extract_options!)
      args << options
      self.class.builder.model_class.paginate(*args)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ar_finder_form-0.1.0 lib/ar_finder_form/client_instance_methods.rb