Class: ViewModels::View

Inherits:
ActionView::Base
  • Object
show all
Defined in:
lib/view_models/view.rb

Overview

View model specific view.

Since:

  • 1.0.0

Instance Method Summary collapse

Constructor Details

#initialize(controller, master_helper_module) ⇒ View

Include the helpers from the view model.

Since:

  • 1.0.0



13
14
15
16
# File 'lib/view_models/view.rb', line 13

def initialize controller, master_helper_module
  singleton_class.send :include, master_helper_module
  super controller.class.view_paths, {}, controller
end

Instance Method Details

#find_template(path, second = nil) ⇒ Object

Rails 3 calls it with 2 arguments

Since:

  • 1.0.0



26
27
28
# File 'lib/view_models/view.rb', line 26

def find_template path, second=nil
  lookup_context.find_template path rescue nil
end

#render_with(options) ⇒ Object

Since:

  • 1.0.0



20
21
22
# File 'lib/view_models/view.rb', line 20

def render_with options
  render options.to_render_options
end