Skip to content

Commit f897fef

Browse files
committed
Fix uninitialized constant Migration (NameError)
1 parent 5eef31a commit f897fef

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

db/migrate/migration_utils/setting_renamer.rb

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,28 @@
2828
# See COPYRIGHT and LICENSE files for more details.
2929
#++
3030

31-
module Migration::MigrationUtils
32-
class SettingRenamer
33-
# define all the following methods as class methods
34-
class << self
35-
def rename(source_name, target_name)
36-
ActiveRecord::Base.connection.execute <<-SQL
37-
UPDATE #{settings_table}
38-
SET name = #{quote_value(target_name)}
39-
WHERE name = #{quote_value(source_name)}
40-
SQL
41-
end
31+
module Migration
32+
module MigrationUtils
33+
class SettingRenamer
34+
# define all the following methods as class methods
35+
class << self
36+
def rename(source_name, target_name)
37+
ActiveRecord::Base.connection.execute <<-SQL
38+
UPDATE #{settings_table}
39+
SET name = #{quote_value(target_name)}
40+
WHERE name = #{quote_value(source_name)}
41+
SQL
42+
end
4243

43-
private
44+
private
4445

45-
def settings_table
46-
@settings_table ||= ActiveRecord::Base.connection.quote_table_name("settings")
47-
end
46+
def settings_table
47+
@settings_table ||= ActiveRecord::Base.connection.quote_table_name("settings")
48+
end
4849

49-
def quote_value(s)
50-
ActiveRecord::Base.connection.quote(s)
50+
def quote_value(s)
51+
ActiveRecord::Base.connection.quote(s)
52+
end
5153
end
5254
end
5355
end

0 commit comments

Comments
 (0)