Sha256: 242c25c29c301e75b206f285f40504360c1901299895718dadf855d58998e27a

Contents?: true

Size: 930 Bytes

Versions: 54

Compression:

Stored size: 930 Bytes

Contents

# encoding: utf-8
class MagicAddresses::StatesController < MagicAddresses::BaseController
  
  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

    # Never trust parameters from the scary internet, only allow the white list through.
    def instance_params
      params.require(:state).permit(:name, :default_name, :short_name, :translations_attributes => [:id, :name, :locale])
    end

end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
magic_addresses-0.0.44 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.43 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.42 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.41 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.40 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.39 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.39.rc8 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.39.rc7 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.39.rc6 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.39.rc5 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.39.rc4 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.39.rc3 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.39.rc2 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.39.rc1 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.38 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.38.beta2 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.38.beta1 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.37 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.36 lib/app/controllers/magic_addresses/states_controller.rb
magic_addresses-0.0.35 lib/app/controllers/magic_addresses/states_controller.rb