[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

populate select with first_name & last_name

Scott Holland

11/24/2007 2:29:00 PM

Hey,

I want to populate a select drop down form helper with FIRST NAME + LAST
NAME.

However, these are both in separate columns in the DB - how can I join
them together?

I can manage to populate it with just the first names, like this...

===VIEW====

<%= select(:first_name, :id, @guests) %>

===CONTROLLER===

@guests = Guest.find(:all, :conditions => ["group_id = ? and
event_id = ?", params[:id], params[:event]]).map { |u| [u.first_name,
u.id]}


Any ideas?

Thanks
--
Posted via http://www.ruby-....

2 Answers

Phrogz

11/24/2007 4:25:00 PM

0

On Nov 24, 7:28 am, Scott Holland <sc...@scottholland.com> wrote:
> I want to populate a select drop down form helper with FIRST NAME + LAST
> NAME.

Try asking this question on the Rails (web framework) group, not the
Ruby (general programming language that Rails happens to use) group.

Robert Dober

11/25/2007 11:09:00 AM

0

On Nov 24, 2007 5:29 PM, Phrogz <phrogz@mac.com> wrote:
> On Nov 24, 7:28 am, Scott Holland <sc...@scottholland.com> wrote:
> > I want to populate a select drop down form helper with FIRST NAME + LAST
> > NAME.
>
> Try asking this question on the Rails (web framework) group, not the
> Ruby (general programming language that Rails happens to use)
Trademark this :)
R.
group.
>
>



--
what do I think about Ruby?
http://ruby-smalltalk.blo...