aboutsummaryrefslogtreecommitdiffstats
path: root/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb')
-rw-r--r--spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb
index 2bcecc7..7d87d84 100644
--- a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb
+++ b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb
@@ -1,30 +1,30 @@
class TranslateCustomTitleOnPages < ActiveRecord::Migration
def self.up
- unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:custom_title)
- add_column ::Refinery::Page.translation_class.table_name, :custom_title, :string
+ unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:menu_title)
+ add_column ::Refinery::Page.translation_class.table_name, :menu_title, :string
- say_with_time("Re-save custom_title") do
+ say_with_time("Re-save menu_title") do
::Refinery::Page.all.each do |page|
- say "updating custom_title field for page##{page.id}"
- page.update_attribute(:custom_title, page.untranslated_attributes['custom_title'])
+ say "updating menu_title field for page##{page.id}"
+ page.update_attribute(:menu_title, page.untranslated_attributes['menu_title'])
end
end
else
- say "Nothing done, ::Refinery::Page.translation_class table already includes a custom_title field"
+ say "Nothing done, ::Refinery::Page.translation_class table already includes a menu_title field"
end
::Refinery::Page.translation_class.reset_column_information
end
def self.down
- say_with_time("Re-save custom_title") do
+ say_with_time("Re-save menu_title") do
::Refinery::Page.all.each do |page|
- if page.attributes['custom_title'].nil?
- say "Nothing done, page##{page.id} custom_title field is nil"
+ if page.attributes['menu_title'].nil?
+ say "Nothing done, page##{page.id} menu_title field is nil"
else
- say "updating custom_title field for page #{page.id}"
+ say "updating menu_title field for page #{page.id}"
::Refinery::Page.update_all({
- :custom_title => page.attributes['custom_title']
+ :menu_title => page.attributes['menu_title']
}, {
:id => page.id.to_s
})
@@ -32,9 +32,9 @@ class TranslateCustomTitleOnPages < ActiveRecord::Migration
end
end
- remove_column ::Refinery::Page.translation_class.table_name, :custom_title
+ remove_column ::Refinery::Page.translation_class.table_name, :menu_title
- ::Refinery::Page.translated_attribute_names.delete(:custom_title)
+ ::Refinery::Page.translated_attribute_names.delete(:menu_title)
::Refinery::Page.translation_class.reset_column_information
end