search for: render_collection_of_partials

Displaying 9 results from an estimated 9 matches for "render_collection_of_partials".

2005 Feb 11
3
render_collection_of_partials vs. loop whats the difference ?
...currently have a single record in the join table to test things. If I use the following in the view (HTML excluded), I get one item returned and rendered: <% @foo.bars.each do |@bar| %> <%= @bar.data %> <% end %> I thought from the docs that this could be rewritten as <%= render_collection_of_partials "bar", @foo.bars %> With, <%= @bar.data %> in _bar.rhtml. With the former, I get the expect single record result. With the latter, I get a single iteration, but my @bar doesn''t have any data. Have I misunderstood the function of r_c_o_p ? Thanks, -- Dominic
2006 Feb 24
1
Help a n00b?
So I''m trying to do that hot new thing with AJAXy forms: http://idiet.toasterwaffles.com/foods/list Here''s the relevant code in list.rhtml (for the form portion) <tbody> <%= render_collection_of_partials "list_stripes", @foods %> </tbody> <tfoot> <tr id="addFood"><%= form_remote_tag( :html => {''id'' => ''createFoodForm''}, :url => {:action => ''crea...
2005 Apr 06
6
Mimic something like layout on a smaller scale?
I need to add various header and footer dressings around groups of form fields for GUI goodness, and am wondering if there''s already something out there that will suit my needs. These headers/footers have special properties for display(title, help links, etc...). I want to be able to easily take advantage of the existing HTML helper methods provided for controllers, in a mini-layout type
2004 Oct 25
1
Rails 0.8: Just shy of 100 additions, changes, tweaks, and fixes!
...tion from Matz on: http://groups.google.com/groups? th=e3a4e68ba042f842&seekm=c3sioe%241qvm%241%40news.cybercity.dk#link14 * Added caching for compiled ERb templates. On Basecamp, it gave between 8.5% and 71% increase in performance [Andreas Schwarz]. * Added implicit counter variable to render_collection_of_partials [Marcel]. From the docs: <%= render_collection_of_partials "ad", @advertisements %> This will render "advertiser/_ad.rhtml" and pass the local variable +ad+ to the template for display. An iteration counter will automatically be made available to the template wi...
2006 Jun 25
4
Zebra Striping a Collection of Partials
I''m using render to display a collection of partials, where each partial is a table row. Is it possible to zebra-stripe the table using this method i.e. alternate table rows get a different CSS class? I can''t work out how each row partial would know whether it was odd or even. In the normal scheme of things I could do: <% odd_or_even = 0 for asset in @assets
2007 May 19
0
database outputting results twice per page (using pagination + sorthelper)
Each page is getting the same 5 db results listed twice, I cant seem to figure out why this is how the page look page 1: post 1 post 2 post 3 post 1 post 2 post 3 page 2: post 4 post 5 post 6 post 4 post 5 post 6 template ------------------------------ <%= render_collection_of_partials "upcoming", @albums_pages %> view (sorry its big) ------------------------------ <% @upcoming.each do |i| %> <div id="album"> <div id="info"><a href="<%= albums_url(:permalink => i.permalink) %>">< %= image_tag url_for_...
2006 Mar 17
1
How to update values in database in this form?
Hi, This is my rHtml page & Corresponding actions & model pages:- ===listform.rHtml================= <h1>Products List</h1> <%= start_form_tag(:action => "add_to_cart")%> <table> <tr> <% i=0 %> <th> Product No. </th> <th> Unit Price </th> <th> Available Qty. </th> <th> Demand Qty. </th>
2006 Feb 20
5
find(:all) vs find_all
I started with Ruby on Rails in the 0.13.x period, so I''m sure I missed out on a lot of history. There''s probably some good explanation for something I''ve been wondering about, but I haven''t seen it written down anywhere. Maybe someone can clue me in. I''ve always felt that one of the uglier APIs was the ActiveRecord::find() method. I call
2006 Mar 16
32
iterating a partial with :collection
following AWDWR book - ''Partials and Collections'' (rather sparse info there too) and I might add that the wiki page on this topic is entirely devoid of any info...be that as it may... I have hash of several arrays that I want to iterate though and display. the first hashed element looks like this (greatly simplified) - :facility: !ruby/object:Facility attributes: