Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Admin::ItemsController < ApplicationController
- def index
- item_resource = ItemResource.new(params)
- @items = item_resource.fetch_for_index
- @form = item_resource.form
- end
- end
- class Admin::ItemResource
- include AdminBits
- def filters
- [:having_name, :price_between]
- end
- def having_name(filter_params)
- resource_class.having_name(filter_params[:name])
- end
- def price_between(filter_params)
- # ...
- end
- def ordering
- [:name, :price]
- end
- def default_order
- :price
- end
- def default_direction
- :desc
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement