Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
accumulating variables in a partial
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
schmii  
View profile  
 More options Dec 12 2008, 1:51 pm
From: schmii <schmi...@gmail.com>
Date: Fri, 12 Dec 2008 10:51:40 -0800 (PST)
Local: Fri, Dec 12 2008 1:51 pm
Subject: accumulating variables in a partial
is there an easy way of accumulating values within a partial? if I
call a partial:

<%= render :partial => 'mobiles', :collection =>
@space_type.spacemobiles %>

and then in the partial '_mobiles'

        <td><b><%= mobiles.width %></b></td>
        <td><b><%= mobiles.length%></b></td>

        <% area = mobiles.width * mobiles.length %>

then I'd like to display the accumulated Area back in the 'SHOW' with
something like this:

<%= "AREA =" + area / 144 %>

thanks in advance

schmii


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
schmii  
View profile  
 More options Dec 15 2008, 2:59 pm
From: schmii <schmi...@gmail.com>
Date: Mon, 15 Dec 2008 11:59:21 -0800 (PST)
Local: Mon, Dec 15 2008 2:59 pm
Subject: Re: accumulating variables in a partial
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 = area + (mobiles.width * mobiles.length) %>

schmii

On Dec 12, 10:51 am, schmii <schmi...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

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