Hi,
What essentially you are doing here is creating an array. So you can prepend
"Local" in the array like this
((1980..Time.now.year).collect {|p| [p.to_s, p.to_s ]}).reverse.unshift
"Local"
I will also suggest you move out this array creation, and put it as a helper
method.
--
अभिनव
http://twitter.com/abhinav
On Thu, Sep 3, 2009 at 1:09 PM, Quee Mm <[email protected]>wrote:
>
> Back again with another question.
>
> For the drop down below
>
> <%= f.select(:year_imported, ((1980..Time.now.year).collect {|p| [
> p.to_s, p.to_s ]}).reverse, :prompt=>"Select a Year") %>
>
> I also want this to contain a value, "Local" as the first one in the
> list. What is the best way to do this?
>
> Quee Mm wrote:
> > I agree with you on that. And will think about converting to integer, I
> > do have two more drop downs with similar values but they do have one or
> > more string values so they do require to be strings but the year_made
> > does not.
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---