Sha256: 68aa567e40f00c1c0d776eeb42ea5dcece0954ef35b302212bb5dcc86f571a01

Contents?: true

Size: 820 Bytes

Versions: 3

Compression:

Stored size: 820 Bytes

Contents

module ViewModels
  module Helpers
    module Mapping
      
      # The Collection view_model helper has the purpose of presenting presentable collections.
      # * Render as list
      # * Render as table
      # * Render as collection
      # * Render a pagination
      #
      class Collection
        private
          
          # Helper method that renders a partial in the context of the context instance.
          #
          # Example:
          #   If the collection view_model helper has been instantiated in the context
          #   of a controller, render will be called in the controller.
          #
          def render_partial name, locals
            @context.instance_eval { render :partial => "view_models/collection/#{name}", :locals => locals }
          end
      end
      
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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