Module: Resubject::Helpers

Defined in:
lib/resubject/rails/helpers.rb

Overview

ActionController helpers

In case you have Rails, these helpers will be automatically included

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

adds present as a helper method in the controller



8
9
10
# File 'lib/resubject/rails/helpers.rb', line 8

def self.included(base)
  base.send(:helper_method, :present)
end

Instance Method Details

#present(objects, *presenters) ⇒ Object

See Also:



13
14
15
16
17
18
19
# File 'lib/resubject/rails/helpers.rb', line 13

def present(objects, *presenters)
  presenters = Builder.present(objects, view_context, *presenters)

  presenters.tap do |p|
    yield p if block_given?
  end
end