Sha256: 9fdb9c7655fddda10537bb68dc50659ebb13f47ac78864475e30c9ada2dd5b42
Contents?: true
Size: 975 Bytes
Versions: 1
Compression:
Stored size: 975 Bytes
Contents
require 'meta_presenter/builder' require 'active_support/concern' module MetaPresenter # Including this module in your controller will give # your views access to a `presenter` method that # delegates to controller methods # # class ApplicationController < ActionController::Base # include MetaPresenter::Base # end # # class ApplicationMailer < ActionMailer::Base # include MetaPresenter::Base # end # module Helpers extend ActiveSupport::Concern included do # Sets up the `presenter.` method as helper within your views # If you want to customize this for yourself just alias_method it helper_method :presenter end private # Initialize presenter with the current controller def presenter @presenter ||= begin controller = self klass = MetaPresenter::Builder.new(controller, action_name).presenter_class klass.new(controller) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
meta_presenter-0.1.4 | lib/meta_presenter/helpers.rb |