Files
openfoodnetwork/app/controllers/spree/admin/states_controller.rb
Luis Ramos e52937c113 Use rubocop auto correct to add frozen string literal to all files
This is an unsafe auto corection, we will need to trust our build here
2021-06-17 23:07:26 +01:00

36 lines
696 B
Ruby

# frozen_string_literal: true
module Spree
module Admin
class StatesController < ::Admin::ResourceController
belongs_to 'spree/country'
before_action :load_data
def index
respond_with(@collection) do |format|
format.html
format.js { render partial: 'state_list' }
end
end
protected
def location_after_save
spree.admin_country_states_url(@country)
end
def collection
super.order(:name)
end
def load_data
@countries = Country.order(:name)
end
def permitted_resource_params
params.require(:state).permit(:name, :abbr)
end
end
end
end