Sha256: 959505544141d06e28dba9237edaffa052d536b5cda1c0d9a206b4a94a0ba13c

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

module Shoppe
  class CountriesController < Shoppe::ApplicationController

    before_filter { @active_nav = :countries }
    before_filter { params[:id] && @country = Shoppe::Country.find(params[:id]) }

    def index
      @countries = Shoppe::Country.ordered
    end

    def new
      @country = Shoppe::Country.new
    end

    def create
      @country = Shoppe::Country.new(safe_params)
      if @country.save
        redirect_to :countries, :flash => {:notice => t('shoppe.countries.create_notice')}
      else
        render :action => "new"
      end
    end

    def edit
    end

    def update
      if @country.update(safe_params)
        redirect_to [:edit, @country], :flash => {:notice => t('shoppe.countries.update_notice') }
      else
        render :action => "edit"
      end
    end

    def destroy
      @country.destroy
      redirect_to :countries, :flash => {:notice => t('shoppe.countries.destroy_notice')}
    end

    private

    def safe_params
      params[:country].permit(:name, :code2, :code3, :continent, :tld, :currency, :eu_member)
    end

  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
shoppe-1.1.2 app/controllers/shoppe/countries_controller.rb
shoppe-1.1.1 app/controllers/shoppe/countries_controller.rb
shoppe-1.1.0 app/controllers/shoppe/countries_controller.rb
shoppe-1.0.9 app/controllers/shoppe/countries_controller.rb
shoppe-1.0.8 app/controllers/shoppe/countries_controller.rb
kylekthompson-shoppe-1.0.7 app/controllers/shoppe/countries_controller.rb
shoppe-1.0.7 app/controllers/shoppe/countries_controller.rb
shoppe-1.0.6 app/controllers/shoppe/countries_controller.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/shoppe-1.0.5/app/controllers/shoppe/countries_controller.rb
shoppe-1.0.5 app/controllers/shoppe/countries_controller.rb
shoppe-1.0.3 app/controllers/shoppe/countries_controller.rb