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

Error in db:migrate on a fresh database when using act_wizardly_for #4

matellis opened this Issue Oct 21, 2009 · 1 comment


None yet
2 participants

I'm using the Lockdown gem with my app. When I drop, create & migrate my database I get this error:

/project/vendor/gems/wizardly- `create':
 Cannot convert :user to model constant for User: Mysql::Error: Table 'project_dev.users'
  doesn't exist: SHOW FIELDS FROM `users`

It's a chicken and egg: the class can't load because there is no User table and there will be no User table until I've ran db:migrate. Commenting out the act_wizardly_for allows me to migrate.

I've seen this before with eager_class_loading but this was fixed in Rails 2.3. (I'm running Rails 2.3.4 and Ruby 1.8.7.)

I fixed it with a nasty hack that disables Lockdown when I'm running db:migrate but I'm pretty sure this will bite me some other way in the future.

I posted an example here http://github.com/matellis/wizardly-examples and filed a bug with Lockdown here http://stonean.lighthouseapp.com/projects/33317/tickets/35

jetpad commented Mar 19, 2010

This problem is also happening for me when I try to deploy my application to Heroku. Same chicken and egg problem but without involving lockdown. This happens right after pushing to a fresh app and then typing "heroku console".

/home/slugs/151205_a99b705_d9bd/mnt/.gems/gems/wizardly_gt- `create': Failed to configure wizard from User validation groups: PGError: ERROR:  relation "users" does not exist (Wizardly::ValidationGroupError)
SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
          FROM pg_attribute a LEFT JOIN pg_attrdef d
            ON a.attrelid = d.adrelid AND a.attnum = d.adnum
         WHERE a.attrelid = '"users"'::regclass
           AND a.attnum > 0 AND NOT a.attisdropped
         ORDER BY a.attnum
    from /home/slugs/151205_a99b705_d9bd/mnt/.gems/gems/wizardly_gt- `configure_wizard_for_model'
    from /home/slugs/151205_a99b705_d9bd/mnt/.gems/gems/wizardly_gt- `act_wizardly_for'
    from /disk1/home/slugs/151205_a99b705_d9bd/mnt/app/controllers/signup_controller.rb:3
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:265:in `require_or_load'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment