Sha256: b1dd1fe03b4313acaab17f3be013feaee8a155885d6cf07b088f87b41959dc41

Contents?: true

Size: 1.04 KB

Versions: 12

Compression:

Stored size: 1.04 KB

Contents

module Ucpengine
  class ApplicationController < ActionController::Base
    before_action :authenticate_user

    protected

    def current_user
      unless defined?(@current_user)
        @current_user = instance_eval(&Ucpengine.configuration.current_user_lookup)
      end
      @current_user
    end
    helper_method :current_user

    def authenticate_user
      return if current_user

      redirect_to instance_eval(&Ucpengine.configuration.sign_in_url)
    end

    def content_entries_path
      entries_path(content_class: content_class.tableize)
    end
    helper_method :content_entries_path

    def content_entry_path(entry)
      entry_path(entry, content_class: content_class.tableize)
    end
    helper_method :content_entry_path

    def new_content_entry_path
      new_entry_path(content_class: content_class.tableize)
    end
    helper_method :new_content_entry_path

    def edit_content_entry_path(entry)
      edit_entry_path(entry, content_class: content_class.tableize)
    end
    helper_method :edit_content_entry_path
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ucpengine-0.1.2 app/controllers/ucpengine/application_controller.rb
ucpengine-0.1.1 app/controllers/ucpengine/application_controller.rb
ucpengine-0.1.0 app/controllers/ucpengine/application_controller.rb
ucpengine-0.0.9 app/controllers/ucpengine/application_controller.rb
ucpengine-0.0.8 app/controllers/ucpengine/application_controller.rb
ucpengine-0.0.7 app/controllers/ucpengine/application_controller.rb
ucpengine-0.0.6 app/controllers/ucpengine/application_controller.rb
ucpengine-0.0.5 app/controllers/ucpengine/application_controller.rb
ucpengine-0.0.4 app/controllers/ucpengine/application_controller.rb
ucpengine-0.0.3 app/controllers/ucpengine/application_controller.rb
ucpengine-0.0.2 app/controllers/ucpengine/application_controller.rb
ucpengine-0.0.1 app/controllers/ucpengine/application_controller.rb