Sha256: ab802549d7400845e63de081ef9cd355fddf8dcebd7d1d46d0b6679e70d3eeb9

Contents?: true

Size: 766 Bytes

Versions: 3

Compression:

Stored size: 766 Bytes

Contents

PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
PADRINO_ENV = 'test' unless defined? PADRINO_ENV

require 'padrino-core'

class RenderUser
  attr_accessor :name
  def initialize(name); @name = name; end
end

class RenderDemo < Padrino::Application

  # partial with object
  get '/partial/object' do
    partial 'template/user', :object => RenderUser.new('John'), :locals => { :extra => "bar" }
  end

  # partial with collection
  get '/partial/collection' do
    partial 'template/user', :collection => [RenderUser.new('John'), RenderUser.new('Billy')], :locals => { :extra => "bar" }
  end

  # partial with locals
  get '/partial/locals' do
    partial 'template/user', :locals => { :user => RenderUser.new('John'), :extra => "bar" }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
padrino-helpers-0.9.10 test/fixtures/render_app/app.rb
padrino-helpers-0.9.9 test/fixtures/render_app/app.rb
padrino-helpers-0.9.7 test/fixtures/render_app/app.rb