Sha256: 050ed2e43cf2dba3d004e929f74b1dd6f8cbfcb34a598f00b08c597c52917f34

Contents?: true

Size: 627 Bytes

Versions: 4

Compression:

Stored size: 627 Bytes

Contents

class ApplicationController < ActionController::Base
  protect_from_forgery
  before_filter :set_current_user
  helper_method :current_user
  before_filter :set_locale

  def current_user
    session[:user_id] ? User.find(session[:user_id]) : User.first
  end

  def set_current_user
    session[:user_id] = User.first
  end

  def toggle_edition_mode
    Interpret.live_edit = !Interpret.live_edit

    redirect_to request.env["HTTP_REFERER"]
  end

  def set_locale
    I18n.locale = params[:locale] || I18n.default_locale
  end

  def default_url_options(options = {})
    options.merge({:locale => I18n.locale})
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
interpret-1.0.2 test_app/app/controllers/application_controller.rb
interpret-1.0.1 test_app/app/controllers/application_controller.rb
interpret-0.2.1 test_app/app/controllers/application_controller.rb
interpret-1.0.0 test_app/app/controllers/application_controller.rb