Bob Smith wrote:
> My model has two fields that I want in a customer list for an index
> page. They are name and second_name. I need a way to combine them in a
> collection with their id numbers so the Edit links will work. Sounds
> like SQL, but I'm not sure.
> 
> maybe something like:
> SELECT name, id FROM households and SELECT second_name, id FROM
> households
> 
> just not sure how to make ONE statement from these two including
> both...
> 
> Thanks
> 
> Bob

I'm not clear what you exactly want..

If you want to display name, second name in ur page,

use this in controller,

Assuming ur model name is Household

@households = Household.all

& in the view,

@households.each do |hh|
  hh.name + hh.second_name
end

this is wht u want?

regards,
Srikanth
http://srikanthjeeva.blogspot.com
-- 
Posted via http://www.ruby-forum.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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to