Date class giving errors

Any time I try to use any methods of the Date class, I get errors of
‘invalid date’. For example, I have this happening:

With the code Date.today, I get this error from Rails:


ArgumentError in Student#show

Showing app/views/student/show.rhtml where line #10 raised:

invalid date

Extracted source (around line #10):

7:

<%= @student.full_contact_info %>


8:

Birthday:
9: <%= # BUG - This doesn’t work for some reason
10: Date.today
11: %>

12: Gender: <%= @student.full_gender %>

13: School Year: <%= @student.school_year %>

RAILS_ROOT: script/…/config/…
Application Trace | Framework Trace | Full Trace

/usr/lib/ruby/1.8/date.rb:591:in new0' /usr/lib/ruby/1.8/Date.rb:703:intoday’
#{RAILS_ROOT}/app/views/student/show.rhtml:10:in
`_run_rhtml_student_show’

/usr/lib/ruby/1.8/date.rb:591:in new0' /usr/lib/ruby/1.8/Date.rb:703:intoday’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:
314:in send' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb: 314:incompile_and_render_template’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:
290:in render_template' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb: 249:inrender_file’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
base.rb:699:in render_file' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ base.rb:621:inrender_with_no_layout’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
layout.rb:243:in render_without_benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ benchmarking.rb:53:inrender’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
benchmarking.rb:53:in measure' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ benchmarking.rb:53:inrender’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
base.rb:911:in perform_action_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ filters.rb:368:inperform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
benchmarking.rb:69:in perform_action_without_rescue' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ benchmarking.rb:69:inmeasure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
benchmarking.rb:69:in perform_action_without_rescue' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ rescue.rb:82:inperform_action’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
base.rb:381:in send' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ base.rb:381:inprocess_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
filters.rb:377:in process_without_session_management_support' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ session_management.rb:117:inprocess’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
dispatch' /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:inhandle_dispatch’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in
service' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/lib/ruby/1.8/webrick/server.rb:155:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:144:in start' /usr/lib/ruby/1.8/webrick/server.rb:144:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:94:in start' /usr/lib/ruby/1.8/webrick/server.rb:89:ineach’
/usr/lib/ruby/1.8/webrick/server.rb:89:in start' /usr/lib/ruby/1.8/webrick/server.rb:79:instart’
/usr/lib/ruby/1.8/webrick/server.rb:79:in start' /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:indispatch’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/
webrick.rb:59
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in require__' /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/
dependencies.rb:147:in require' /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire__’
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in require' /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/ dependencies.rb:147:inrequire’
script/server:3

/usr/lib/ruby/1.8/date.rb:591:in new0' /usr/lib/ruby/1.8/Date.rb:703:intoday’
#{RAILS_ROOT}/app/views/student/show.rhtml:10:in
_run_rhtml_student_show' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb: 314:insend’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:
314:in compile_and_render_template' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb: 290:inrender_template’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:
249:in render_file' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ base.rb:699:inrender_file’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
base.rb:621:in render_with_no_layout' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ layout.rb:243:inrender_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
benchmarking.rb:53:in render' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ benchmarking.rb:53:inmeasure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
benchmarking.rb:53:in render' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ base.rb:911:inperform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
filters.rb:368:in perform_action_without_benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ benchmarking.rb:69:inperform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
benchmarking.rb:69:in measure' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ benchmarking.rb:69:inperform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
rescue.rb:82:in perform_action' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ base.rb:381:insend’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
base.rb:381:in process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/ filters.rb:377:inprocess_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/
session_management.rb:117:in process' /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:indispatch’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in
handle_dispatch' /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:inservice’
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
/usr/lib/ruby/1.8/webrick/server.rb:155:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:144:instart’
/usr/lib/ruby/1.8/webrick/server.rb:144:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:94:instart’
/usr/lib/ruby/1.8/webrick/server.rb:89:in each' /usr/lib/ruby/1.8/webrick/server.rb:89:instart’
/usr/lib/ruby/1.8/webrick/server.rb:79:in start' /usr/lib/ruby/1.8/webrick/server.rb:79:instart’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in
dispatch' /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/ webrick.rb:59 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire__’
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in require' /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/ dependencies.rb:147:inrequire’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in require__' /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/
dependencies.rb:147:in `require’
script/server:3

Request

Parameters: {“id”=>“6”}

Show session dump


flash: !ruby/hash:ActionController::Flash::FlashHash {}

Response
Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}


Oh, also, if I run ‘ruby script/console’ and load up the app’s
environment, I don’t get that error. It returns today’s date as
expected.

Any ideas? Thanks so much for your help. This one is driving me insane.
-geoffrey

Geoffrey L. @ HydroMint Media
[email protected] // Skype: HydroMint
Thompsons Station, Tennessee

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs