Sha256: 1c17a8b83c9181b3e029f2b7f2e58adb7e817d5b877c34758535fca1aadc7cfe

Contents?: true

Size: 742 Bytes

Versions: 3

Compression:

Stored size: 742 Bytes

Contents

module ViewModels
  # View model specific view.
  #
  class View < ActionView::Base
    
    # Shut up, opinionated funkers.
    #
    alias singleton_class metaclass unless instance_methods.include?('singleton_class')
    
    # Include the helpers from the view model.
    #
    def initialize controller, master_helper_module
      singleton_class.send :include, master_helper_module
      super controller.class.view_paths, {}, controller
    end
    
    #
    #
    def render_with options
      render options.to_render_options
    end

    # Finds the template in the view paths at the given path, with its format.
    #
    def find_template path
      view_paths.find_template path, template_format rescue nil
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
view_models-2.0.1 lib/rails2/lib/view_models/view.rb
view_models-2.0.0.ruby19 lib/rails2/lib/view_models/view.rb
view_models-2.0.0 lib/rails2/lib/view_models/view.rb