Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

'script/generate clearance' creates migration with wrong name if 'users' table already exists #73

Closed
rnewman57 opened this Issue Feb 20, 2010 · 2 comments

Comments

Projects
None yet
2 participants

If I run 'script/generate clearance' on a Rails application that already has a 'users' table, it creates a migration whose class name is ClearanceUpdateUsers but whose file name is ses/db/migrate/20100220184217_clearance_update_users_to_0_8_6.rb .

Because the class name and file name do not match, this happens when I run 'rake db:migrate' :

uninitialized constant ClearanceUpdateUsersTo086

/Users/ronnewman/.gem/ruby/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in load_missing_constant' /Users/ronnewman/.gem/ruby/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:inconst_missing_with_dependencies'
/Users/ronnewman/.gem/ruby/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in const_missing' /Users/ronnewman/.gem/ruby/1.9.1/gems/activesupport-2.3.5/lib/active_support/inflector.rb:372:inconst_get'
/Users/ronnewman/.gem/ruby/1.9.1/gems/activesupport-2.3.5/lib/active_support/inflector.rb:372:in block in constantize' /Users/ronnewman/.gem/ruby/1.9.1/gems/activesupport-2.3.5/lib/active_support/inflector.rb:371:ineach'
/Users/ronnewman/.gem/ruby/1.9.1/gems/activesupport-2.3.5/lib/active_support/inflector.rb:371:in constantize' /Users/ronnewman/.gem/ruby/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:inconstantize'
/Users/ronnewman/.gem/ruby/1.9.1/gems/activerecord-2.3.5/lib/active_record/migration.rb:374:in load_migration' /Users/ronnewman/.gem/ruby/1.9.1/gems/activerecord-2.3.5/lib/active_record/migration.rb:369:inmigration'
[rest of stack truncated -- I don't think you need it here]

Workaround is to manually change the migration class name (to ClearanceUpdateUsersTo086 ) or change the migration file name (to remove "_to_0_8_6" )

Contributor

croaky commented Feb 21, 2010

Confirmed. Just fixed with this commit:

http://github.com/thoughtbot/clearance/commit/340f518feea9e9c294ce922b3890b3f54ce44f01

Thanks for the report.

qrush pushed a commit to qrush/clearance that referenced this issue May 24, 2012

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment