On 3 Feb 2009, at 12:42, Qaiser Wali wrote:

>
> I have a drop down in my forms.
>
> Year Manufactured The value needs to be from 1970 -- current year
>
> In the new form i am using the following code
>
> <select name="vehicle[year_made]" id="vehicle_year_made">
> <option value="0" selected="selected">-- Select --</option>
> <%= options_from_collection_for_select((1970..Time.now.year).collect
> {|p| [ p, p ] }, "first", "last") %>
> </select>
>

You could use select_year

Fred
> I want to be able to show the items in reverse order. Where the most
> recent year shows first.
>
> Also in the edit form i want similar code but with the selected item  
> to
> be the one that is present in the database. How can i achieve this?
> -- 
> 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 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