Class: Spree::Api::CitiesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/cities_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/spree/api/cities_controller.rb', line 6

def index
  @cities = scope.ransack(params[:q]).result.
    includes(:state).order(name: :asc).
    page(params[:page]).per(params[:per_page])

  city = City.order(updated_at: :asc).last
  if stale?(city)
    respond_with(@cities)
  end
end

#showObject



17
18
19
20
# File 'app/controllers/spree/api/cities_controller.rb', line 17

def show
  @city = scope.find(params[:id])
  respond_with(@city)
end