diff --git a/Support/bin/insert_add_column_or_create_table.rb b/Support/bin/insert_add_column_or_create_table.rb index 46a26f00..54869457 100755 --- a/Support/bin/insert_add_column_or_create_table.rb +++ b/Support/bin/insert_add_column_or_create_table.rb @@ -25,7 +25,7 @@ def unprepend(text, prefix) end # Find 'self.down' method -if self_down = buffer.find { /^(\s*)def\s+self\.down\b/ } +if self_down = buffer.find { /^(\s*)def\s+(self\.|)down\b/ } indentation = self_down[1] # Find the matching create_table clause in the schema.rb file diff --git a/Support/bin/intelligent_migration_snippet.rb b/Support/bin/intelligent_migration_snippet.rb index 12c75bd7..0c886894 100755 --- a/Support/bin/intelligent_migration_snippet.rb +++ b/Support/bin/intelligent_migration_snippet.rb @@ -94,7 +94,7 @@ def insert_migration(snippet, text) # find the beginning of self.down and insert down code, this is hardly robust. # assuming self.down is after self.up in the class lines.each_with_index do |line, i| - if line =~ /^\s*def\s+self\.down\b/ + if line =~ /^\s*def\s+(self\.|)down\b/ lines[i, 1] = [lines[i], down_code] break end