I have a "New Photo" view where I''d like to provide a select
dropdown
of the user''s favorite locations. Getting the data for a
user''s
favorites is no problem, but I''m not sure how to put the location name
into the select form.
def new
@photo = Photo.new
@favorites = current_user.favorites.find(:all, :include
=> :location)
end
<%= f.collection_select :location_id,
@favorites, :location_id, :location_id, { :include_blank => true }, {}
%>
(the 4th parameter in the f.collection_select above is my problem)
On a related note, is there a more efficient way to query for the
locations'' id & name w/o returning all fields? Or is it not really
that much of a performance issue?
Any tips would be greatly appreciated. Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---