# "uninitialized constant Deprecated" with rake db:migrate

**URL:** <https://www.ruby-forum.com/t/uninitialized-constant-deprecated-with-rake-db-migrate/68057>\
**Category:** Rails\
**Created:** [September 8, 2006, 8:12pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-deprecated-with-rake-db-migrate/68057 "2006-09-08T20:12:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![metrix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@metrix](https://www.ruby-forum.com/u/metrix)\
**Post date:** [September 8, 2006, 8:12pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-deprecated-with-rake-db-migrate/68057/1 "2006-09-08T20:12:23Z")

</div>

I’ve been chuggin along with Agile Web D. with Rails, got up to  
Chapter 13 then discivered the Second Edition of the book.

I installed the latest Edge Rails (to get support for :decimal) so I  
could get a feel for the migrations described in Interatiosn A1 and A2.

I’m working with a brand new rails app and database.

Below are the migration files and the trace from rake. Any ideas whats  
up? Should I use a different version of Rails, or just roll back to the  
last stable release and not use :integer instead of :decimal just so I  
can get through the lesson?

#001\_create\_products.rb  
class CreateProducts \< ActiveRecord::Migration  
def self.up  
create\_table :products do |t|  
t.column :title, :string  
t.column :description, :text  
t.column :image\_url, :string  
end  
end

def self.down  
drop\_table :products  
end  
end

#002\_add\_price.rb  
class AddPrice \< ActiveRecord::Migration  
def self.up  
add\_column :products, :price, :decimal, :precision =\> 8, :scale =\>  
2, :default =\> 0  
end

def self.down  
remove\_column :products, :price  
end  
end

(in C:/projects/railswork/depot2)  
\*\* Invoke db:migrate (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
rake aborted!  
uninitialized constant Deprecated  
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:123:in  
`const_missing' C:/projects/railswork/depot2/config/../vendor/rails/actionpack/lib/action_controller/base.rb:211 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:147:in  
`require' C:/projects/railswork/depot2/config/../vendor/rails/actionpack/lib/action_controller.rb:37 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:147:in  
`require' C:/projects/railswork/depot2/config/../vendor/rails/railties/lib/initializer.rb:160:in`require\_frameworks’  
C:/projects/railswork/depot2/config/…/vendor/rails/railties/lib/initializer.rb:160:in  
`require_frameworks' C:/projects/railswork/depot2/config/../vendor/rails/railties/lib/initializer.rb:82:in`process’  
C:/projects/railswork/depot2/config/…/vendor/rails/railties/lib/initializer.rb:42:in  
`run' C:/projects/railswork/depot2/config/../config/environment.rb:13 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
C:/projects/railswork/depot2/config/…/vendor/rails/railties/lib/tasks/misc.rake:3  
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in`execute’  
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke' C:/ruby/lib/ruby/1.8/thread.rb:135:in`synchronize’  
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in`invoke\_prerequisites’  
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in `each' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:363:in`invoke\_prerequisites’  
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in `invoke' C:/ruby/lib/ruby/1.8/thread.rb:135:in`synchronize’  
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in`run’  
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run’  
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7  
C:/ruby/bin/rake.bat:25

---

<div class="post-metadata">

**Author:** ![metrix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@metrix](https://www.ruby-forum.com/u/metrix)\
**Post date:** [September 8, 2006, 8:34pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-deprecated-with-rake-db-migrate/68057/2 "2006-09-08T20:34:38Z")

</div>

I think I figured out a good workaround for now…

class AddPrice \< ActiveRecord::Migration  
def self.up  
#add\_column :products, :price, :decimal, :precision =\> 8, :scale =\>  
2, :default =\> 0  
execute “ALTER TABLE products ADD COLUMN price DECIMAL(8,2) NOT NULL  
DEFAULT 0”  
end

def self.down  
remove\_column :products, :price  
end  
end

---

<div class="post-metadata">

**Author:** ![metrix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@metrix](https://www.ruby-forum.com/u/metrix)\
**Post date:** [September 8, 2006, 11:03pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-deprecated-with-rake-db-migrate/68057/3 "2006-09-08T23:03:08Z")

</div>

On 9/8/06, Brandon C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> def self.down  
> remove\_column :products, :price  
> end  
> end

So you went to edge rails to get support for :decimal, then completely  
work around it? Why not just go back to “production” rails?

–  
There is nothing more difficult to take in hand, more perilous to  
conduct, or more uncertain in its success, than to take the lead in  
the introduction of a new order of things. – Niccolo Machiavelli

---

<div class="post-metadata">

**Author:** ![metrix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@metrix](https://www.ruby-forum.com/u/metrix)\
**Post date:** [September 8, 2006, 11:12pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-deprecated-with-rake-db-migrate/68057/4 "2006-09-08T23:12:21Z")

</div>

Sorry, I didn’t specify. I rolled back to gem rails, and then I applied  
the work around.

Michael C. wrote:

> On 9/8/06, Brandon C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > def self.down  
> > remove\_column :products, :price  
> > end  
> > end
> 
> So you went to edge rails to get support for :decimal, then completely  
> work around it? Why not just go back to “production” rails?
> 
> –  
> There is nothing more difficult to take in hand, more perilous to  
> conduct, or more uncertain in its success, than to take the lead in  
> the introduction of a new order of things. – Niccolo Machiavelli
