Rails Apps - scaffold error - ruby-on-rails

I'm having a rails app problem when executing the scaffold command in my command line. I used the rails generate scaffold User name:string email:string command that our teacher showed us today. His worked, but mine gets the following.
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/dynamic_matchers.rb:55:in `method_missing': undefined method `migration_error=' for ActiveRecord::Base:Class (NoMethodError)
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/railtie.rb:66:in `block (3 levels) in <class:Railtie>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/railtie.rb:65:in `each'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.13/lib/active_record/railtie.rb:65:in `block (2 levels) in <class:Railtie>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
There are more lines, but I would hope that you get the idea. If I need to post the rest, I will. Beyond that, if there is another question that has the answer to this, please point me in that direction. Thank you in advance.

Try set up your database first by running this command
rake db:drop db:create db:migrate
or
rake db:reset

Related

Rails upgrade from 5.0 to 5.1 - Cannot start webrick [duplicate]

Before writing this question I looked at these answers, but was unable to find a solution.:
Error when execute rails generate scaffold User name:string email:string
rake aborted! undefined method `migration_error=' for ActiveRecord::Base:Class
Error launching Rails server: undefined method 'configure'
When I try to start a new application (for Hartl's tutorial, Chapter 2), at the stage scaffold start, I got an error like:
**undefined method `configure' for #<SampleApp2::Application:0x00000101a74610> (NoMethodError)**
But thanks to the above examples, I edited the development.rb file:
DemoApp::Application.configure do
(Yes, my application is called demo_app so I transformed its name).
After that, I tried to run scaffold again but got a new error:
**method_missing': undefined method raise_in_transactional_callbacks=' for ActiveRecord::Base:Class (NoMethodError)**
In response to similar cases indicates a migration method - that it should be removed from the file development.rb. Similarly, I tried to find in this file raise_in_transactional_callbacks method, but it's not there!
In addition, I would say that the full code that produces in cmd is very large:
C:\Sites\demo_app>rails generate scaffold User name:string email:string
invoke active_record
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `raise_in_transactional_callbacks=' for ActiveRecord::Base:Class (NoMethodError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/railtie.rb:166:in `block (3 levels) in <class:Railtie>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/railtie.rb:165:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-4.0.2/lib/active_record/railtie.rb:165:in `block (2 levels) in <class:Railtie>'
…
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/commands.rb:48:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Where the ...(ellipsis) - specially cut similar code.
That's all. I would be grateful for any help!
Your config/application.rb has the following line:
config.active_record.raise_in_transactional_callbacks = true
This is not a valid configuration value in your version of Rails. You will need to delete it or comment it out to continue.
Note: this error and the one that preceded it are indicative of an incomplete Rails version change. If you are in the early stages of a tutorial, you might seriously consider restarting your application using your preferred version of Rails from the very start. This will help you avoid this type of error until you are more familiar with the technology.
I had the same issue when upgrading an app from Rails 5.0.1 to Rails 5.1.0.beta1.
When starting the server (rails s), I got the following error message:
/home/user01/.rvm/gems/ruby-2.4.0#global/gems/activerecord-5.1.0.beta1/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `raise_in_transactional_callbacks=' for ActiveRecord::Base:Class (NoMethodError)
Same ills, same cures.
Commenting out the following line, in config/application.rb, solved the issue...
config.active_record.raise_in_transactional_callbacks = true
After some investigation, I found that this line was default in Rails 4.2.1, vanished in Rails 5.0.0, and now raises an error in Rails 5.1.0.beta1...
If you don't see config.active_record.raise_in_transactional_callbacks = true in config/application.rb it might exist in your environment configs. For my app it was being set it in config/environments/development.rb and config/environments/test.rb

Rails database migration error

I wanna get started with ror but this problem seems unsolvable. I know there are many threads about it this database error but none of the solutions appear to work out. I now searched through the forums all afternoon, with no success.
I basically just perform the first tasks from the textbook, which are as follows:
I create a new RoR project (Windows 10, SQLite3) with
rails new depot
Then I create a scaffold in this project with the following code:
rails generate scaffold Product title:string description:text image_url:string price:decimal
And as i test the application I get the db:migrate error. I tried rake db:migrate, db:rollback, db:drop and then db:create, I checked the migration file for mistakes, but nothing appears to work.
I assume the solution should be quite simple, since the application should be as uncomplex as it gets at this state, but I just cannot get behind the secret it appears.
Migrations are pending. To resolve this issue, run:
bin/rails db:migrate RAILS_ENV=test
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/migration.rb:586:in `load_schema_if_pending!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/migration.rb:592:in `block in maintain_test_schema!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/migration.rb:823:in `suppress_messages'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/migration.rb:597:in `method_missing'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/migration.rb:592:in `maintain_test_schema!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/test_help.rb:15:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in `require'
from C:/Users/Flori/Desktop/bsp/test/test_helper.rb:3:in `<top (required)>'
from C:/Users/Flori/Desktop/bsp/test/controllers/products_controller_test.rb:1:in `require'
from C:/Users/Flori/Desktop/bsp/test/controllers/products_controller_test.rb:1:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/test_unit/test_requirer.rb:11:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/test_unit/test_requirer.rb:11:in `block in require_files'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/test_unit/test_requirer.rb:10:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/test_unit/test_requirer.rb:10:in `require_files'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/test_unit/minitest_plugin.rb:86:in `plugin_rails_init'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/minitest-5.10.1/lib/minitest.rb:80:in `block in init_plugins'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/minitest-5.10.1/lib/minitest.rb:78:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/minitest-5.10.1/lib/minitest.rb:78:in `init_plugins'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/minitest-5.10.1/lib/minitest.rb:129:in `run'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/test_unit/minitest_plugin.rb:73:in `run'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/minitest-5.10.1/lib/minitest.rb:62:in `block in autorun'
Switch of your server, then run
rake db:drop db:create db:migrate
This must fix your problem

rake db:migrate:reset to dump schema

Hell, I'm following in Hartl's Ruby on Rails tutorial and I'm on chapter 9 adding administrative control to users.
I'm at the part where it says
reset the database:
$ bundle exec rake db:migrate:reset
$ bundle exec rake db:seed
Last time I followed this (much earlier in the tutorial), it reset the database as instructed but also deleted me schema.rb. Which was annoying.
Attempted it again, and yet again it deleted my database and erased my schema.rb. Surely this is not intended.
I'm having trouble figuring out what I should be doing anymore. I'm now getting all kinds of errors with my database. I get errors about pending migrations, but no db:xxx command works, every command just spits out this long list of errors such as
/Users/Ke0/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/Users/Ke0/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:956:in `block in migrate'
/Users/Ke0/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `each'
/Users/Ke0/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `migrate'
/Users/Ke0/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:820:in `up'
/Users/Ke0/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:798:in `migrate'
/Users/Ke0/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/Ke0/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
What does one do in such a situation?
try to verify following :-
you have the db with username/password mentioned in database.yml
you have db empty
when you run rake db:migrate,then schema.rb is getting generated
you have a valid database.yml file

DB Errors with Rails test

I'm trying to learn Rails, and running into a bit of a problem I don't understand. I started with Hartl's book and looking at this error message, it looks like something to do with what I was doing for that.
Now that I'm on a new project, I get this when I try to run a test on my routes file.
1) Error:
test_that_/login_route_opens_the_login_page(CursomRoutesTest):
ActiveRecord::StatementInvalid: Could not find table 'statuses'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:472:in `table_structure'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:346:in `columns'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:660:in `column_names'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:652:in `timestamp_column_names'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:585:in `block in table_rows'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:579:in `each'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:579:in `map'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:579:in `table_rows'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:494:in `block (3 levels) in create_fixtures'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:492:in `each'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:492:in `block (2 levels) in create_fixtures'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:491:in `block in create_fixtures'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract_adapter.rb:168:in `disable_referential_integrity'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:476:in `create_fixtures'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:895:in `load_fixtures'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:849:in `setup_fixtures'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:418:in `_run__3689392786993953837__setup__3124079788890242138__callbacks'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/TomEllis/.rvm/gems/ruby-1.9.3-p392#rails3tutorial2ndEd/gems/activesupport-3.2.13/lib/active_support/testing/setup_and_teardown.rb:35:in `run'
1 tests, 0 assertions, 0 failures, 1 errors, 0 skips
You probably haven't run the rake task to prepare your test database:
bundle exec rake db:test:prepare
bundle exec rake db:test:clone
I'm also a Rails newbie and I encountered a very similar problem (working on a different project, but getting errors referencing Hartl). After mulling it over in my head and googling, I believe I found the overall problem and solution.
Still, could anyone explain what the reference to the rails3tutorial is in the gems and how to remove it?
When we started the rails tutorial, Hartl advised us to run the following command:
$ rvm use 1.9.3#rails3tutorial2ndEd --create --default
Using /Users/mhartl/.rvm/gems/ruby-1.9.3 with gemset rails3tutorial2ndEd
(http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=3.2#sec-install_rubygems)
The outcome?
...any time we open a new terminal window the 1.9.3#rails3tutorial2ndEd Ruby/gemset combination is automatically selected.
I fixed this by running:
rvm use 1.9.3-p484 --default
(http://rvm.io/gemsets/using)
This made the "regular" gemset our default gemset (as opposed to our custom Hart tutorial gemset). I'm pretty sure "regular gemset" is the wrong term, but I'm still in the beginner phase, so my apologies to everyone who knows the correct term. I hope that helps!

Rake db:migration aborted

I've got a unfinished project that a developer just didn't finish and didn't leave any documentation about the installation process. I've downloaded the production directory to my windows machine (running InstantRails 2), I created the databases as required in the database.yml and I tried to run the rake:db:migrate --trace but I'm receiving the following error message:
(in D:/projects/broke2)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
uninitialized constant Admin
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:279:in `load_missing_constant'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:468:in `const_missing'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:480:in `const_missing'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/inflector.rb:285:in `constantize'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/inflector.rb:284:in `each'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/inflector.rb:284:in `constantize'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/core_ext/string/inflections.rb:143:in `constantize'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:481:in `migrations'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/mysql_adapter.rb:15:in `inject'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:465:in `each'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:465:in `inject'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:465:in `migrations'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:431:in `migrate'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:373:in `up'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/migration.rb:356:in `migrate'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/tasks/databases.rake:99
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain'
D:/InstantRails-2.0-win/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run'
D:/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31
D:/InstantRails-2.0-win/ruby/bin/rake:19:in `load'
D:/InstantRails-2.0-win/ruby/bin/rake:19
I'm a regular Rails developer (it's not my first app) but I never saw this error and I don't have a clue where to start to debug.
Sometimes Rails will throw this error if there's a syntax error where Admin is defined.
Try looking for admin.rb and make sure that it parses.
Also, you may want to try running the migrations one at a time (rake db:migrate VERSION=1, etc.) to see if that helps you track down which migration causes the error, or if it is a problem simply booting the application.
I suspect you had a migration that created a table and added some data using a model. Later in the project the model got renamed or removed (as did the table maybe?). As the model no longer existed the migrations failed to run, but no one noticed as by that point they were only running a few migrations at a time, not from a clean database.
The lesson here ... if you rename models or tables (or update their validations and fields) then check your migrations run from scratch as well on the current production version.
I'd say your problem is in the uninitialized constant Admin part of your migration issue. Have you tried finding where Admin is initialized and including the path to that wherever you're using it? (Also, what's the contents of the rake task you're running?)
It don't points me where i have a Admin constant. There is a way to check at least where should I look? my models, my controllers, etc?
rake db:migrate VERSION=1, gives me a error already. As I told you, am I just trying to finish a project unfinished by another guy.
How can i do a migration file per file?
Regards,
Victor
You can try loading the schema all at once instead of executing each migration:
rake db:schema:load
As RichH said there might have been a change to the schema not reflected in the migrations

Resources