Sha256: 44678e6e02a86906593c5d851fb68ecb97aa69b5f8938e50d2ed351804a05ec9
Contents?: true
Size: 724 Bytes
Versions: 7
Compression:
Stored size: 724 Bytes
Contents
module Spree module Api class StatesController < Spree::Api::BaseController def index @states = scope.ransack(params[:q]).result. includes(:country).order('name ASC') if params[:page] || params[:per_page] @states = @states.page(params[:page]).per(params[:per_page]) end respond_with(@states) end def show @state = scope.find(params[:id]) respond_with(@state) end private def scope if params[:country_id] @country = Country.find(params[:country_id]) return @country.states else return State.scoped end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems