Sha256: f58b2106480220f75539310a52c0be55284647c982a52dd56eb02b8ff1f4683e

Contents?: true

Size: 627 Bytes

Versions: 6

Compression:

Stored size: 627 Bytes

Contents

module Spina
  class ApplicationController < ActionController::Base
    protect_from_forgery with: :exception
    helper_method :current_theme, :current_user, :current_account

    include ApplicationHelper

    private

    def current_ability
      @current_ability ||= Ability.new(current_user)
    end

    def current_theme
      @current_theme = ::Spina.themes.detect{|theme| theme.name == current_account.theme }
    end

    def current_user
      @current_user ||= User.where(id: session[:user_id]).first if session[:user_id]
    end

    def current_account
      @current_account ||= Account.first
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spina-0.8.3 app/controllers/spina/application_controller.rb
spina-0.8.2 app/controllers/spina/application_controller.rb
spina-0.8.1 app/controllers/spina/application_controller.rb
spina-0.8.0 app/controllers/spina/application_controller.rb
spina-0.7.3 app/controllers/spina/application_controller.rb
spina-0.7.2 app/controllers/spina/application_controller.rb