Sha256: 22fe75a9cf587fd698a8718fcb020671857caeddecbeaf5d8cdfd77717943ca4

Contents?: true

Size: 598 Bytes

Versions: 4

Compression:

Stored size: 598 Bytes

Contents

module Spina
  module CurrentMethods
    extend ActiveSupport::Concern
    
    included do
      helper_method :current_theme
      helper_method :current_spina_user
      helper_method :current_account
    end
  
    private
    
      def current_theme
        @current_theme ||= Spina::Theme.find_by_name(current_account.theme)
      end
      
      def current_spina_user
        @current_spina_user ||= Spina::User.where(id: session[:user_id]).first if session[:user_id]
      end
    
      def current_account
        @current_account ||= Spina::Account.first
      end
        
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spina-2.0.2 app/controllers/concerns/spina/current_methods.rb
spina-2.0.1 app/controllers/concerns/spina/current_methods.rb
spina-2.0.0 app/controllers/concerns/spina/current_methods.rb
spina-2.0.0.beta app/controllers/concerns/spina/current_methods.rb