Class: CurrencyController

Inherits:
Spree::BaseController
  • Object
show all
Defined in:
app/controllers/currency_controller.rb

Instance Method Summary collapse

Instance Method Details

#setObject



3
4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/currency_controller.rb', line 3

def set
  if @currency = Currency.find_by_char_code(params[:id].to_s.upcase)
    session[:currency_id] = params[:id].to_s.upcase.to_sym
    Currency.current!(@currency)
    flash.notice = t(:currency_changed)
  else
    flash[:error] = t(:currency_not_found)
  end

  redirect_back_or_default(root_path)
end