Jason Hsu, Mr. Swift Linux
2011-Sep-04 20:29 UTC
How do I make "rake db:migrate" work properly?
I''m going through the 4th (current) edition of the book _Agile Web Development with Rails_. I''m using Ubuntu 11.04 in VirtualBox with ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux], gem 1.3.7, and Rails 3.0.5. (I had to downgrade Rails from 3.1.0.) I''ve gone through the exercises in chapter 2 with no problems. I''m now in chapter 6, and the "rake db:migrate" command malfunctions. The error message I''m getting is: WARNING: Global access to Rake DSL methods is deprecated. Please include ... Rake::DSL into classes and modules which use the Rake DSL methods. WARNING: DSL method Depot::Application#task called at /var/lib/gems/ 1.8/gems/railties-3.0.5/lib/rails/application.rb:214:in `initialize_tasks'' rake aborted! What exactly are the Rake DSL methods, and what does deprecated global access mean, and how do I fix this? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Curiously, you listed the versions of every program except the one that is throwing the error.> I''ve gone through the exercises in chapter 2 with no problems.Not very helpful for people who don''t have the book. I don''t know if this is your problem or not....but in any case you should never be issuing the command: rake db:migrate The whole idea behind Bundler and your Gemfile is to specify which gems you want to use for your app. To use the gems in your Gemfile when executing commands, you need to proceed the command with ''bundle exec'': bundle exec rake db:migrate That makes sure you are using the rake gem specified in your Gemfile. and bundle exec rails generate ... That makes sure you are using the rails gem in your Gemfile. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, With rails 3.1 and some new gems versions the books can become complicated. There are better ways to do it, but in your case (starting from zero) I''ll suggest: 1. Delete new versions of rails: gem uninstall rails Select "All versions" 2. Install the right rails gem for the book (between 3.0.1 and 3.0.9 all work) gem install rails --version 3.0.9 3. Delete newer versions of rake and stay with the old one gem uninstall rake gem install rake --version 0.8.7 4. Start the project from zero (As far as I remember it wasn''t a lot of work). rails new depot rails generate scaffold .... rake db:migrate Greetings, El 04/09/2011 22:29, Jason Hsu, Mr. Swift Linux escribió:> I''m going through the 4th (current) edition of the book _Agile Web > Development with Rails_. I''m using Ubuntu 11.04 in VirtualBox with > ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux], gem 1.3.7, and > Rails 3.0.5. (I had to downgrade Rails from 3.1.0.) > > I''ve gone through the exercises in chapter 2 with no problems. I''m > now in chapter 6, and the "rake db:migrate" command malfunctions. The > error message I''m getting is: > > WARNING: Global access to Rake DSL methods is deprecated. Please > include > ... Rake::DSL into classes and modules which use the Rake DSL > methods. > WARNING: DSL method Depot::Application#task called at /var/lib/gems/ > 1.8/gems/railties-3.0.5/lib/rails/application.rb:214:in > `initialize_tasks'' > rake aborted! > > What exactly are the Rake DSL methods, and what does deprecated global > access mean, and how do I fix this? >-- Miquel Cubel Escarré +34 699 73 22 46 mcubel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org "Computers are good at following instructions, but not at reading your mind." Donald Knuth. "Los ordenadores son buenos siguiendo instrucciones, pero no leyendo tu mente." Donald Knuth. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 5, 8:48 am, 7stud -- <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Curiously, you listed the versions of every program except the one that > is throwing the error. > > > I''ve gone through the exercises in chapter 2 with no problems. > > Not very helpful for people who don''t have the book. > > I don''t know if this is your problem or not....but in any case you > should never be issuing the command: > > rake db:migrate > > The whole idea behind Bundler and your Gemfile is to specify which gems > you want to use for your app. To use the gems in your Gemfile when > executing commands, you need to proceed the command with ''bundle exec'': > > bundle exec rake db:migrate > > That makes sure you are using the rake gem specified in your Gemfile.That''s not the whole story. If just running rake (without the bundle exec) selected a version of rake that was incompatible with what''s in the Gemfile/Gemfile.lock then bundler produces an appropriate version message. The problem is the the Gemfile generated by default in a rails app didn''t specify a version of rake (possibly because until recently rake hadn''t changed much - 0.8.7 was released in May 2009 and 0.9 was released in May 2011), so bundler will pick the most recent version of rake as the one to use. Unfortunately rake 0.9 had some incompatible changes. Newer versions of rails support rake 0.9.x (I think the first such rails version was 3.0.9). You could either switch to the latest 3.0.x version or you need to specify in your Gemfile that you want rake 0.8.7 Fred> > and > > bundle exec rails generate ... > > That makes sure you are using the rails gem in your Gemfile. > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote in post #1020189:> On Sep 5, 8:48am, 7stud -- <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> rake db:migrate >> >> The whole idea behind Bundler and your Gemfile is to specify which gems >> you want to use for your app. To use the gems in your Gemfile when >> executing commands, you need to proceed the command with ''bundle exec'': >> >> bundle exec rake db:migrate >> >> That makes sure you are using the rake gem specified in your Gemfile. > > That''s not the whole story. If just running rake (without the bundle > exec) selected a version of rake that was incompatible with what''s in > the Gemfile/Gemfile.lock then bundler produces an appropriate version > message.That''s not what this says: ==In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle. == -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Miquel Cubel wrote in post #1020180:> Hi, > > With rails 3.1 and some new gems versions the books can become > complicated. > > There are better ways to do it, but in your case (starting from > zero) I''ll suggest: > > 1. Delete new versions of rails: > gem uninstall rails > > Select "All versions" > > 2. Install the right rails gem for the book (between 3.0.1 and > 3.0.9 all work) > gem install rails --version 3.0.9 > > 3. Delete newer versions of rake and stay with the old one > gem uninstall rake > gem install rake --version 0.8.7 > > 4. Start the project from zero (As far as I remember it wasn''t a > lot of work). > rails new depot > rails generate scaffold .... > rake db:migrate > > Greetings, >Ignore all that. . . . . . . .. . . . . . . -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 5, 2:44 pm, 7stud -- <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Frederick Cheung wrote in post #1020189: > > > On Sep 5, 8:48am, 7stud -- <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> rake db:migrate > > >> The whole idea behind Bundler and your Gemfile is to specify which gems > >> you want to use for your app. To use the gems in your Gemfile when > >> executing commands, you need to proceed the command with ''bundle exec'': > > >> bundle exec rake db:migrate > > >> That makes sure you are using the rake gem specified in your Gemfile. > > > That''s not the whole story. If just running rake (without the bundle > > exec) selected a version of rake that was incompatible with what''s in > > the Gemfile/Gemfile.lock then bundler produces an appropriate version > > message. > > That''s not what this says: > > ==> In some cases, running executables without bundle exec may work, if the > executable happens to be installed in your system and does not pull in > any gems that conflict with your bundle. > ==Sorry, by version message I meant an error message about how the version of gems pulled in by not using bundle exec conflict with the versions bundler would had picked (i think it even hints at using bundle exec). Anyway, using bundle exec won''t help if what is in Gemfile/ Gemfile.lock is causing bundler to select rake 0.9 when in fact the OP wants rake 0.8.7. Fred> > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.