Uninitialized constant ApplicationController and Migration problem in rails 2.3


Uninitialized constant ApplicationController...... error in rails 2.3

if you have recently upgraded your rails version to 2.3 or higher. you will get this error.

uninitialized constant ApplicationController…..

application.rb was renamed to application_controller.rb in Rails 2.3

To fix this error, rename your application.rb to application_controller.rb :)


Migration problem in ruby on rails.

During migration i often face problem which says ….syntax error, unexpected ā€˜\n’, expecting tCOLON2…blablabla

Whenever we use scaffold to develop any simple AMD tool, migration files generate automatically, and we often face such error during migration. we generally think that, those files are ok, but its not always true, you can easily fix those errors and it’s not such a big deal also :)

open that migration file from db/migrate/file_that_causing_syntax_error.rb

and search for syntax error, you will definitely find few syntax errors there. (generally you will see (comma) is misplaced in several lines).

def self.up
create_table :posts do |t|
t.string, :title
t.string, :body
t.datetime, :mod_date
t.timestamps
end
end

So try to fix those errors and migrate db again. I hope this will help.

Single file migration

You can also migrate a single file, to do this you have to mention the version number of that file, such as

rake db:migrate:up VERSION=20090421094006 (place your own file’s version_number)

rake db:migrate:up and rake db:migrate:down let you run the up and down operations of an individual migration.

You can get help regarding rails migration in the following link (one of my favourite rails migration cheatsheet)

http://dizzy.co.uk/ruby_on_rails/cheatsheets/rails-migrations

  1. No comments yet.
(will not be published)
  1. No trackbacks yet.