diff options
Diffstat (limited to 'rubocop/migration_helpers.rb')
-rw-r--r-- | rubocop/migration_helpers.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/rubocop/migration_helpers.rb b/rubocop/migration_helpers.rb index 577f768da67..c066d424437 100644 --- a/rubocop/migration_helpers.rb +++ b/rubocop/migration_helpers.rb @@ -3,17 +3,15 @@ module RuboCop module MigrationHelpers # Returns true if the given node originated from the db/migrate directory. def in_migration?(node) - dirname(node).end_with?('db/migrate', 'db/geo/migrate') || in_post_deployment_migration?(node) - end + dirname = File.dirname(node.location.expression.source_buffer.name) - def in_post_deployment_migration?(node) - dirname(node).end_with?('db/post_migrate', 'db/geo/post_migrate') + dirname.end_with?('db/migrate', 'db/post_migrate') end - private + def in_post_deployment_migration?(node) + dirname = File.dirname(node.location.expression.source_buffer.name) - def dirname(node) - File.dirname(node.location.expression.source_buffer.name) + dirname.end_with?('db/post_migrate') end end end |