aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrate
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2015-12-10 20:19:46 +0100
committerHarald Eilertsen <haraldei@anduin.net>2015-12-10 20:19:46 +0100
commit71a6a2e8e46eb84a76f75b54bea266d40aa5e6be (patch)
tree3217dacd0a00ab39e80a8ef9aaed8905bf21150e /db/migrate
parent5dc8b93400d77edb8cd65e67f4ea667fbd163c8a (diff)
downloadhmnoweb-71a6a2e8e46eb84a76f75b54bea266d40aa5e6be.tar.gz
hmnoweb-71a6a2e8e46eb84a76f75b54bea266d40aa5e6be.tar.bz2
hmnoweb-71a6a2e8e46eb84a76f75b54bea266d40aa5e6be.zip
Move existing posts to proper locale.
This makes sure the existing posts appear after the upgrade.
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20151210191646_move_posts_to_proper_locale.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/db/migrate/20151210191646_move_posts_to_proper_locale.rb b/db/migrate/20151210191646_move_posts_to_proper_locale.rb
new file mode 100644
index 0000000..faeaf3c
--- /dev/null
+++ b/db/migrate/20151210191646_move_posts_to_proper_locale.rb
@@ -0,0 +1,9 @@
+class MovePostsToProperLocale < ActiveRecord::Migration
+ def up
+ Refinery::Blog::Post::Translation.all.each { |tx| tx.locale = "nb"; tx.save! }
+ end
+
+ def down
+ Refinery::Blog::Post::Translation.all.each { |tx| tx.locale = "en"; tx.save! }
+ end
+end