Brandon Casci
2006-Sep-08 18:12 UTC
"uninitialized constant Deprecated" with rake db:migrate
I''ve been chuggin along with Agile Web Development 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Brandon Casci
2006-Sep-08 18:34 UTC
Re: "uninitialized constant Deprecated" with rake db:migrate
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Michael Campbell
2006-Sep-08 20:04 UTC
Re: "uninitialized constant Deprecated" with rake db:migrate
On 9/8/06, Brandon Casci <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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 > endSo 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Brandon Casci
2006-Sep-08 21:12 UTC
Re: "uninitialized constant Deprecated" with rake db:migrate
Sorry, I didn''t specify. I rolled back to gem rails, and then I applied the work around. Michael Campbell wrote:> On 9/8/06, Brandon Casci <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---