Question

When I execute the command Date.today in my rails command, I get the following error:

I can't do a simple Date.today in my Rails console

ruby-1.9.2-p180 :026 >   >> require 'date'
 => false 

ruby-1.9.2-p180 :027 >   >> Date.today
ArgumentError: invalid date
    from /Users/besi/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/date.rb:809:in `civil'
    from /Users/besi/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/Date.rb:1810:in `today'
    from (irb):27
    from /Users/besi/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
    from /Users/besi/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
    from /Users/besi/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
    from /Users/besi/Dropbox/projects/Freelance/vidis/VidiServer/script/rails:6:in `require'
    from /Users/besi/Dropbox/projects/Freelance/vidis/VidiServer/script/rails:6:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

In the irb console this works without problems:

ruby-1.9.2-p180 :001 > require 'date'
 => true 
ruby-1.9.2-p180 :002 > Date.today
 => #<Date: 2013-04-15 (4912795/2,0,2299161)> 
Was it helpful?

Solution

It looks like there is a problem with the RubyMine Plugin here. When I do the same thing in the console it works. I don't know though why such a simple thing should not work in RubyMine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top