module PresenterObject::Presentable
Include this concern in a model class to easily wrap the model in a presenter e.g:
class Document < ActiveRecord::Base
include PresenterObject::Presentable
end
Now turn any instance into a presenter-wrapped model e.g:
document = Document.find(params).presenterize
Constants
- PresenterNotRegistered
Public Instance Methods
presenter_class()
click to toggle source
# File lib/presenter_object/presentable.rb, line 27 def presenter_class self.class.presenter_class end
presenterize(view_context = nil)
click to toggle source
# File lib/presenter_object/presentable.rb, line 31 def presenterize(view_context = nil) presenter_class.new self, view_context end