diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-15 12:47:50 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-15 12:47:50 +0000 |
commit | db6179d12f06895aa3d813c495ff77bbddf439d1 (patch) | |
tree | 53345a24eb049c2e0c9e25b5db6b4f405ec1988d /actionpack/lib/action_view | |
parent | 846a1236bc3f02cc01515f7aa6ee986344ae53c8 (diff) | |
download | rails-db6179d12f06895aa3d813c495ff77bbddf439d1.tar.gz rails-db6179d12f06895aa3d813c495ff77bbddf439d1.tar.bz2 rails-db6179d12f06895aa3d813c495ff77bbddf439d1.zip |
Fixed DateHelper#date_select so that you can pass include_blank as an option even if you don't use start_year and end_year #59 [what-a-day]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@167 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rwxr-xr-x | actionpack/lib/action_view/helpers/date_helper.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 8af3afb034..58dab783d5 100755 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -158,7 +158,8 @@ module ActionView # select_year(Date.today, :start_year => 1992, :end_year => 2007) def select_year(date, options = {}) year_options = [] - unless date.kind_of?(Fixnum) then default_start_year, default_end_year = date.year - 5, date.year + 5 end + y = date.kind_of?(Fixnum) ? (y = (date == 0) ? Date.today.year : date) : date.year + default_start_year, default_end_year = y-5, y+5 (options[:start_year] || default_start_year).upto(options[:end_year] || default_end_year) do |year| year_options << ((date.kind_of?(Fixnum) ? date : date.year) == year ? |