Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion accumulating variables in a partial

View parsed - Show only message text

MIME-Version: 1.0
Received: by 10.151.102.16 with SMTP id e16mr564373ybm.0.1229371161195; Mon, 
	15 Dec 2008 11:59:21 -0800 (PST)
Date: Mon, 15 Dec 2008 11:59:21 -0800 (PST)
In-Reply-To: <b3bbb307-5c10-4e3b-a0df-74c48dd71bec@i18g2000prf.googlegroups.com>
X-IP: 207.216.166.172
References: <b3bbb307-5c10-4e3b-a0df-74c48dd71bec@i18g2000prf.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) 
	AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1,gzip(gfe),gzip(gfe)
Message-ID: <4c6dace7-db3d-4c55-9444-614eb4976ebf@r36g2000prf.googlegroups.com>
Subject: Re: accumulating variables in a partial
From: schmii <schmi...@gmail.com>
To: "Vancouver.rb - Vancouver Ruby/Rails Developers" <vanrb@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

thanks but I was able to resolve my own dilemma by taking it out of
the
partial and placing it in a local 'do' loop:

<% @space_type.spacemobiles.each do |mobiles| %>

	<% area =3D area + (mobiles.width * mobiles.length) %>

schmii


On Dec 12, 10:51=A0am, schmii <schmi...@gmail.com> wrote:
> is there an easy way of accumulating values within a partial? if I
> call a partial:
>
> <%=3D render :partial =3D> 'mobiles', :collection =3D>
> @space_type.spacemobiles %>
>
> and then in the partial '_mobiles'
>
> =A0 =A0 =A0 =A0 <td><b><%=3D mobiles.width %></b></td>
> =A0 =A0 =A0 =A0 <td><b><%=3D mobiles.length%></b></td>
>
> =A0 =A0 =A0 =A0 <% area =3D mobiles.width * mobiles.length %>
>
> then I'd like to display the accumulated Area back in the 'SHOW' with
> something like this:
>
> <%=3D "AREA =3D" + area / 144 %>
>
> thanks in advance
>

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google