"uninitialized constant Deprecated" with rake db:migrate

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:inrequire’
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:inrequire’
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:inrequire_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:inprocess’
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:inrequire’
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:inexecute’
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:insynchronize’
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:ininvoke_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:ininvoke_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:insynchronize’
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:inrun’
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

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

On 9/8/06, Brandon C. [email protected] 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

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. [email protected] 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