Class: Spree::Api::CountiesController
- Inherits:
-
BaseController
- Object
- BaseController
- Spree::Api::CountiesController
- Defined in:
- app/controllers/spree/api/counties_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/spree/api/counties_controller.rb', line 8 def index @counties = scope.ransack(params[:q]).result. includes(:state).order('name ASC') if params[:page] || params[:per_page] @counties = @counties.page(params[:page]).per(params[:per_page]) end county = @counties.last if stale?(county) respond_with(@counties) end end |
#show ⇒ Object
22 23 24 25 |
# File 'app/controllers/spree/api/counties_controller.rb', line 22 def show @county = scope.find(params[:id]) respond_with(@county) end |