Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HairTrigger::migrations_current? returning a wrong result #25

Closed
elhoyos opened this issue Mar 18, 2014 · 1 comment
Closed

HairTrigger::migrations_current? returning a wrong result #25

elhoyos opened this issue Mar 18, 2014 · 1 comment

Comments

@elhoyos
Copy link

elhoyos commented Mar 18, 2014

  1. Make one of your models to have a simple trigger
  2. Generate the migration and run it

HairTrigger::migrations_current? will return false despite you have done step 2.

I can see the migration name from prepared_actions is not present in the trigger definitions. Reason of this is that the method in charge of its initialization, #prepared_name, is never called.

Current tests pass because #generate_migration will iterate through trigger definitions while calling the name-initialization method.

@jenseng
Copy link
Owner

jenseng commented Mar 18, 2014

@elhoyos good catch... in fact it looks like it's only broken if you have a single migration with a single trigger. As soon as you have multiple triggers or trigger migrations, it works correctly (e.g. here's an example where it has correctly and consistently reported out-of-date triggers, but this app has lots of triggers/migrations).

#prepared_name does get called, but only once something is in all_builders (i.e. > 1 trigger). Should be a pretty easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants