Well that was easy! After a little trial and error, I created a new
method in the area.rb and used the name of that method in the
collection select :-) Cheers



On Jul 2, 11:48 pm, "@demetriusolsen" <demetri...@hotmail.com> wrote:
> I have two tables: Area, AreaType
>
> Area  belongs_to :area_type
> AreaType has_many :areas
>
> In my view, I'd like to select from a list of Areas, however, instead
> of using the :area_type_id attribute, I would like to use the
> associated area_type names. Here's what it looks like now:
>
> <%= f.collection_select(:area_id, Area.where(:subject_id =>
> @search.subject_id), :id, :area_type_id, {:include_blank => true} ) %>
>
> What I want is:
> <%= f.collection_select(:area_id, Area.where(:subject_id =>
> @search.subject_id), :id, area.area_type.name, {:include_blank =>
> true} ) %>
>
> Anyone know how I would go about creating the area.area_type.name
> "symbol" to user here?
>
> 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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to