Agile Web Development

Build it. Launch it. Love it.

better_partials

Provides syntactic sugar for render :partial

http://www.railsjedi.com/posts/22

Examples

Render a partial

  <%= partial "people/search_box" %>

Pass some parameters in

  <% form_for @person do |f| %>
    <%= partial "people/form", :f => f %>
  <% end %>

Pass in a collection

  <%= partial "people/person", :collection => @people %>

Or the terse way

  <%= partials @people %>

Also works, but not as nice reading

  <%= partial @people %>

Rendering a block

  <% partial "people/box" do %>
    Inner connect goes here.. (gets called in your partial's yield statement)
  <% end %>

Special Partial Options pass through to render :partial (all others are passed through to the :locals parameter)

  :collection,
  :spacer_template,
  :object,
  :use_full_path

Vitals

Home http://code.google.com/p/betterpartials/
Repository http://betterpartials.googlecode.com/svn/trunk/better_partials
License Rails' (MIT)
Tags Tag_red helpers partial partials pritchettb views
Rating (9 votes)
Owner Jacques Crocker
Created 5 April 2008

Comments

  • Avatar
    Xin
    17 April 2008

    I have been using this for a week now. I find it incredibly useful and plan to use it for every project from now on.

    Thanks for your work!

  • Avatar
    Xin
    17 April 2008

    I have been using this for a week now. I find it incredibly useful and plan to use it for every project from now on.

    Thanks for your work!

Add a comment