Sha256: 9b5d19fb89d5733bcc6d3b91142af9d5c23cd892ffa1067f0e847323a2fc8c5d

Contents?: true

Size: 816 Bytes

Versions: 2

Compression:

Stored size: 816 Bytes

Contents

require 'active_record'
require 'livelist/rails/filter_collection'

module Livelist
  module Rails
    module ActiveRecord

      def filters
        @filters ||= FilterCollection.new
      end

      def filter_for(slug, options = {})
        filters.create_filter(
          :reference_criteria => options[:reference_criteria],
          :name               => options[:name],
          :model_name         => model_name,
          :attribute          => options[:attribute],
          :key_name           => options[:key_name],
          :slug               => slug
        )
      end

      def filters_as_json(params, options = {})
        filters.as_json(scoped, params, options)
      end

      def filter(params, options = {})
        filters.relation(scoped, params, options)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
livelist-rails-0.0.16 lib/livelist/rails/active_record.rb
livelist-rails-0.0.15 lib/livelist/rails/active_record.rb