Module: SteelWheel::Filters::ClassMethods

Defined in:
lib/steel_wheel/filters.rb

Overview

rubocop:disable Style/Documentation

Instance Method Summary collapse

Instance Method Details

#filter(name, &definition) ⇒ Object



12
13
14
# File 'lib/steel_wheel/filters.rb', line 12

def filter(name, &definition)
  define_method("filter_by_#{name}", &definition)
end

#filterable(name) ⇒ Object



16
17
18
19
20
21
# File 'lib/steel_wheel/filters.rb', line 16

def filterable(name)
  alias_method :"initial_#{name}_scope", name
  define_method(name) do
    apply_filters(send(:"initial_#{name}_scope"), form_params.to_h)
  end
end