# Changing Date Format - it works, but then I get a "uninitialized constant ActiveSupport"

**URL:** <https://www.ruby-forum.com/t/changing-date-format-it-works-but-then-i-get-a-uninitialized-constant-activesupport/147987>\
**Category:** Rails\
**Created:** [September 8, 2008, 3:18am UTC](https://www.ruby-forum.com/t/changing-date-format-it-works-but-then-i-get-a-uninitialized-constant-activesupport/147987 "2008-09-08T03:18:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [September 8, 2008, 3:18am UTC](https://www.ruby-forum.com/t/changing-date-format-it-works-but-then-i-get-a-uninitialized-constant-activesupport/147987/1 "2008-09-08T03:18:39Z")

</div>

Hi,

When I change date formats via the following entry in environments.rb  
it works fine. Web pages reflect the new date format.  
“ActiveSupport::CoreExtensions:📅:Conversions::DATE\_FORMATS[:default]”

The issue is when I run things like “./script/console”, or  
"./script/spec " I get a “NameError: uninitialized constant  
ActiveSupport” issue. Any ideas how to solve this?

* * *

Macintosh-2:myequity greg$ ./script/console  
Loading development environment (Rails 2.1.1)  
/Users/greg/source/myequity/config/environment.rb:69:NameError:  
uninitialized constant ActiveSupport  
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/action\_controller/dispatcher.rb:93:NoMethodError:  
undefined method `cattr_accessor' for ActionController:: Dispatcher:Class /opt/local/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/console_with_helpers.rb:19:NoMethodError: undefined method`require\_dependency’ for main:Object

> >

## Macintosh-2:myequity greg$ ./script/spec spec/models/transaction\_spec.rb /Users/greg/source/myequity/config/environment.rb:69: uninitialized constant ActiveSupport (NameError) from /opt/local/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/initializer.rb:95:in `run' from /Users/greg/source/myequity/config/environment.rb:20 from /Users/greg/source/myequity/spec/spec_helper.rb:4:in`require’ from /Users/greg/source/myequity/spec/spec\_helper.rb:4 from ./spec/models/transaction\_spec.rb:1:in `require' from ./spec/models/transaction_spec.rb:1 from /Users/greg/source/myequity/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:14:in`load’ from /Users/greg/source/myequity/vendor/plugins/rspec/lib/spec/runner/example\_group\_runner.rb:14:in `load_files' from /Users/greg/source/myequity/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:13:in`each’ from /Users/greg/source/myequity/vendor/plugins/rspec/lib/spec/runner/example\_group\_runner.rb:13:in `load_files' from /Users/greg/source/myequity/vendor/plugins/rspec/lib/spec/runner/options.rb:98:in`run\_examples’ from /Users/greg/source/myequity/vendor/plugins/rspec/lib/spec/runner/command\_line.rb:19:in `run’ from ./script/spec:4 Macintosh-2:myequity greg$

thanks in advance

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [September 8, 2008, 4:01am UTC](https://www.ruby-forum.com/t/changing-date-format-it-works-but-then-i-get-a-uninitialized-constant-activesupport/147987/2 "2008-09-08T04:01:59Z")

</div>

oh…I see there was an answer to this in a previous forum post that  
solves this:

looks like you’ve put the ActiveSupport line inside the  
Rails::Initializer.run block.  
you need to put it at the end of your environment.rb file, else  
ActiveSupport hasn’t yet been loaded… hence the exception it raises.

On Mon, Sep 8, 2008 at 11:17 AM, Greg H.
