[Rails] Trying to do a report with a list of zip codes and getting stuck..
I'm trying to get a list of zip codes in my database with
zipstring = sprintf("select distinct zip from visits,households where
" +
"households.id=visits.household_id and visits.month='%2d' and
visits.year = '%4d' " +
"and visits.monthly = 1 order by households.zip;", datestart.month,
datestart.year, dateend, datestart)
@ziplist = Household.find_by_sql(zipstring)
this gives me an array of zip codes. Then I use
<%= render :partial=>"monthly_report", :collection => @ziplist %>
to run monthly_report for each zip code. This is where the problem is.
If I try to put the variable into a find call, it isn't text.
If I look at it in the debugger, it's
#<Household zip: "01501">
and .to_s is
"#<Household:0xb68ad9e4>"
All I need is the 01501 part, but I'm getting the memory address in my
find call. Please help.
Thanks
Bob Smith <bsm2th@gmail.com>
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home