10 Jun 2013, 00:36
Generic-user-small

Martin W. (3 posts)

Hi, I just got stuck at A1 somehow. I deleted the depot folder after a typo and did the setup again. rails new depot than rails generate scaffold Product \​ title:string description:text image_url:string price:decimal​​ after that I restarted the server, but an error occures with Action Controller: Migrations are pending; run 'rake db:migrate RAILS_ENV=development' to resolve this issue. I tried to -> rake db:migrate:redo - what did not solve the issue neither -> rake db:migrate RAILS_ENV=development …

Could you please point me in the right direction? Many thanks, Martin

environment: Xfce Ubuntu 12.04 ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux] Rails 4.0.0.beta1

10 Jun 2013, 13:43
Samr_small_pragsmall

Sam Ruby (584 posts)

I can’t explain how you got to this state, but explaining these messages may help. What rails is comparing is the contents of db/development.sqlite3 against the directory db/migrate. If you are starting over, it probably would be best to delete both.

11 Jun 2013, 00:08
Generic-user-small

Martin W. (3 posts)

Hi Sam, thank you for your quick reply. I started over already without changing anything in

rails40/depot_a/db/migrate/20121130000001_create_products.rb 

just to see if it would work. and before I started over again I deleted the folder depot completely. What you mean with delete both? thank you very much.

12 Jun 2013, 18:02
Samr_small_pragsmall

Sam Ruby (584 posts)

Martin: just a guess: did you stop your server?

Stopping your server, deleting the depot directory, and starting over with rails new depot; cd depot, rails generate scaffold Product title:string description:text image_url:string price:decimal, etc should work as described in the book.

15 Jun 2013, 00:43
Generic-user-small

Martin W. (3 posts)

Sam, that’s exactly what I’m doing every time I try it. that’s what the server shows.

capponz@bronzy:~/work/depot$ rails server
=> Booting WEBrick
=> Rails 4.0.0.beta1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-06-15 12:32:38] INFO  WEBrick 1.3.1
[2013-06-15 12:32:38] INFO  ruby 1.9.3 (2011-10-30) [i686-linux]
[2013-06-15 12:32:38] INFO  WEBrick::HTTPServer#start: pid=32716 port=3000


Started GET "/products" for 127.0.0.1 at 2013-06-15 12:32:58 +1200

ActiveRecord::PendingMigrationError (Migrations are pending; run 'rake db:migrate RAILS_ENV=development' to resolve this issue.):
  activerecord (4.0.0.beta1) lib/active_record/migration.rb:357:in `check_pending!'
  activerecord (4.0.0.beta1) lib/active_record/migration.rb:346:in `block in call'
  activesupport (4.0.0.beta1) lib/active_support/logger_silence.rb:16:in `silence'
  activerecord (4.0.0.beta1) lib/active_record/migration.rb:345:in `call'
  actionpack (4.0.0.beta1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.0.0.beta1) lib/active_support/callbacks.rb:373:in `_run__379149325__call__callbacks'
  activesupport (4.0.0.beta1) lib/active_support/callbacks.rb:78:in `run_callbacks'
  actionpack (4.0.0.beta1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.0.0.beta1) lib/action_dispatch/middleware/reloader.rb:64:in `call'
  actionpack (4.0.0.beta1) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  actionpack (4.0.0.beta1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.0.0.beta1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.0.beta1) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.0.beta1) lib/rails/rack/logger.rb:21:in `block in call'
  activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.0.beta1) lib/rails/rack/logger.rb:21:in `call'
  actionpack (4.0.0.beta1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.0.0.beta1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  actionpack (4.0.0.beta1) lib/action_dispatch/middleware/static.rb:64:in `call'
  railties (4.0.0.beta1) lib/rails/engine.rb:510:in `call'
  railties (4.0.0.beta1) lib/rails/application.rb:96:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
  /usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /usr/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'


  Rendered /var/lib/gems/1.9.1/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/_source.erb (1.0ms)
  Rendered /var/lib/gems/1.9.1/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.8ms)
  Rendered /var/lib/gems/1.9.1/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.5ms)
  Rendered /var/lib/gems/1.9.1/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (67.8ms)

And that’s what the action controller replies.: No matter when and how. And of course I restarted the server.

ActiveRecord::PendingMigrationError

Migrations are pending; run 'rake db:migrate RAILS_ENV=development' to resolve this issue.

Rails.root: /home/capponz/work/depot

Application Trace | Framework Trace | Full Trace
Request

Parameters:

None
Toggle session dump
Toggle env dump
Response

Headers:

None

I’m quite sad about this issue. And I have no idea how to fix this issue to move on. thanks anyway.

15 Jun 2013, 19:02
Samr_small_pragsmall

Sam Ruby (584 posts)

The closest I can find is somebody who created a project with mysql and didn’t create the database.

Let’s test if sqlite3 is installed correctly. Try running:

ruby -r sqlite3 -e "SQLite3::Database.new 'test.db'"
  You must be logged in to comment