Plugins - better_partials

StarAdd to favorites

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

Jacques Crocker

http://code.google.com/p/betterpartials/

http://betterpartials.googlecode.com/svn/trunk/better_partials

Rails' (MIT)

  • Currently 4.6/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

View Extensions

Tags

Comments

Add a comment
Xin 17 Apr 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!

Xin 17 Apr 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!

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?