Sha256: dd696c70529e8614c8c21b64594307df2e476dd66d9d7fcdc53e3904f7e2d679
Contents?: true
Size: 699 Bytes
Versions: 2
Compression:
Stored size: 699 Bytes
Contents
require 'ruhl/rails/active_record_presenter' class RuhlPresenter include ActiveRecordPresenter attr_reader :presentee, :context def initialize(obj, context) @presentee = obj @context = context define_paths(obj.class.name.underscore.downcase) end end module ActionController class Base protected def present(object_sym, action_sym) render :template => "#{object_sym.to_s.pluralize}/#{action_sym}", :locals => {:object => presenter_for( instance_variable_get("@#{object_sym}") )} end def presenter_for(obj) eval("#{obj.class.name}Presenter").new(obj, @template) end helper_method :presenter_for end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruhl-0.14.0 | lib/ruhl/rails/ruhl_presenter.rb |
ruhl-0.13.0 | lib/ruhl/rails/ruhl_presenter.rb |