Created
July 23, 2013 12:42
-
-
Save danielpuglisi/6062070 to your computer and use it in GitHub Desktop.
Seiten application controller helper methods, inspired by devise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Seiten | |
module Controllers | |
# Those helpers are convenience methods added to ApplicationController. | |
module Helpers | |
extend ActiveSupport::Concern | |
def current_page | |
@current_page ||= Seiten::Page.find_by_slug(request.fullpath) | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'seiten/engine' | |
require 'seiten/page_store' | |
require 'seiten/page' | |
module Seiten | |
@config = { | |
storage_type: :yaml, | |
storage_file: File.join('config', 'navigation.yml'), | |
storage_directory: File.join('app', 'pages') | |
} | |
def self.config | |
@config | |
end | |
module Controllers | |
autoload :Helpers, 'seiten/controllers/helpers' | |
end | |
ActiveSupport.on_load(:action_controller) do | |
include Controllers::Helpers | |
helper_method :current_page | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment