Module: Puffer::Controller::Mutate
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/puffer/controller/mutate.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #process_action(method_name, *args) ⇒ Object
- #puffer_filters ⇒ Object
- #puffer_namespace ⇒ Object
- #record ⇒ Object
- #records ⇒ Object
- #resource ⇒ Object
Instance Method Details
#process_action(method_name, *args) ⇒ Object
13 14 15 16 |
# File 'lib/puffer/controller/mutate.rb', line 13 def process_action method_name, *args params[:puffer] = Rails.application.routes.resources_tree[params[:puffer]] if params[:puffer] super end |
#puffer_filters ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/puffer/controller/mutate.rb', line 18 def puffer_filters @puffer_filters ||= begin filters = params[Puffer::Filters.model_name.param_key] || {} filters.reverse_merge! :puffer_order => configuration.order if configuration.order.present? filters.reverse_merge! :puffer_per_page => configuration.per_page if configuration.per_page.present? Puffer::Filters.new filter_fields, filters end end |
#puffer_namespace ⇒ Object
27 28 29 |
# File 'lib/puffer/controller/mutate.rb', line 27 def puffer_namespace request.path_info.split('/').delete_if(&:blank?).first.to_sym end |
#record ⇒ Object
35 36 37 |
# File 'lib/puffer/controller/mutate.rb', line 35 def record @record || instance_variable_get("@#{resource.model_name}") end |
#records ⇒ Object
39 40 41 |
# File 'lib/puffer/controller/mutate.rb', line 39 def records @records || instance_variable_get("@#{resource.model_name.pluralize}") end |