class MagicAddresses::StatesController
Public Instance Methods
index()
click to toggle source
# File lib/app/controllers/magic_addresses/states_controller.rb, line 4 def index order_locales = [ I18n.locale ] order_locales << :en unless I18n.locale == :en @states = ::MagicAddresses::State.includes(:translations).with_translations(order_locales).order( 'mgca_state_translations.name ASC' ) # @states = ::MagicAddresses::State.includes(:translations).with_translations(I18n.locale).order( 'mgca_state_translations.name ASC' ) # @states = ::MagicAddresses::State.includes(:translations).order("mgca_state_translations.name ASC") @states = ::MagicAddresses::State.includes(:translations).order(short_name: :asc) end
Private Instance Methods
instance_params()
click to toggle source
Never trust parameters from the scary internet, only allow the white list through.
# File lib/app/controllers/magic_addresses/states_controller.rb, line 16 def instance_params params.require(:state).permit(:name, :default_name, :short_name, :translations_attributes => [:id, :name, :locale]) end