Skip to content

Instantly share code, notes, and snippets.

@danielpuglisi
Created July 23, 2013 12:42
Show Gist options
  • Save danielpuglisi/6062070 to your computer and use it in GitHub Desktop.
Save danielpuglisi/6062070 to your computer and use it in GitHub Desktop.
Seiten application controller helper methods, inspired by devise
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
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