I am trying to upgrade Rails from 2.3 to 3.1. I watched the upgrade video from Railscast but I am having some difficulties.
Steps I followed:
gem install rails -v 3.0.20
.rails upgrade check
and rails upgrade backup
using Rails upgrade plugin.rails new . --skip-active-record
When I start the server I am getting this error:
initializers/new_rails_defaults.rb:13:in `<top (required)>': undefined method `use_standard_json_time_format=' for ActiveSupport:Module (NoMethodError)
Can anyone please help?
The default for use_standard_json_time_format
changed between Rails 3.0.20 and 3.1.0 from false
to true
, so depending which version you're aiming for (your question mentions both), you might be able to drop the configuration.
If you're cherry-picking ActiveSupport modules, make sure you've required ActiveSupport::JSON::Encoding
, which defines the method.
require 'active_support'
require 'active_support/json/encoding'
And since ActiveSupport.use_standard_json_time_format
is just delegating to ActiveSupport::JSON::Encoding
, you can also try calling it directly on the latter.
ActiveSupport::JSON::Encoding.use_standard_json_time_format = true