Created
December 20, 2014 20:07
-
-
Save adamniedzielski/f376b0bfcf7011862433 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment