diff options
author | Adrien Coquio <adrien.coquio@gmail.com> | 2012-06-03 21:37:41 +0200 |
---|---|---|
committer | Philip Arndt <parndt@gmail.com> | 2012-06-09 11:19:38 +1200 |
commit | d0c249af2a2e630ac993eb23a691ef996613b55f (patch) | |
tree | 6992cf3816a6f5b1e022637a6780a7d24f1753cf /db | |
parent | 7743fab73a5c60d9f5f0cf2ce65a3f0914b1376f (diff) | |
download | refinerycms-blog-d0c249af2a2e630ac993eb23a691ef996613b55f.tar.gz refinerycms-blog-d0c249af2a2e630ac993eb23a691ef996613b55f.tar.bz2 refinerycms-blog-d0c249af2a2e630ac993eb23a691ef996613b55f.zip |
Added i18n support to models through globalize3.
* Added Post translation
* Added Category translation
* Use friendly_id globalize with category
* Added migrate_data option on migrations for translations
* Use Refinery locale instead of I18n
* Refactored duplicate locale_picker partial
* Removed useless .all call
* Use presence instead if / blank?
* Added with_globalize scopes when loading posts of one category
* Use Globalize when creating post factory
* Fix failing specs by creating blog posts/categories using needed locale.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20120530102901_create_blog_translations.rb | 17 | ||||
-rw-r--r-- | db/migrate/20120531113632_delete_cached_slugs.rb | 6 | ||||
-rw-r--r-- | db/migrate/20120601151114_create_category_translations.rb | 14 |
3 files changed, 37 insertions, 0 deletions
diff --git a/db/migrate/20120530102901_create_blog_translations.rb b/db/migrate/20120530102901_create_blog_translations.rb new file mode 100644 index 0000000..c301f42 --- /dev/null +++ b/db/migrate/20120530102901_create_blog_translations.rb @@ -0,0 +1,17 @@ +class CreateBlogTranslations < ActiveRecord::Migration + def up + Refinery::Blog::Post.create_translation_table!({ + :body => :text, + :custom_teaser => :text, + :custom_url => :string, + :slug => :string, + :title => :string + }, { + :migrate_data => true + }) + end + + def down + Refinery::Blog::Post.drop_translation_table! :migrate_data => true + end +end diff --git a/db/migrate/20120531113632_delete_cached_slugs.rb b/db/migrate/20120531113632_delete_cached_slugs.rb new file mode 100644 index 0000000..14c8653 --- /dev/null +++ b/db/migrate/20120531113632_delete_cached_slugs.rb @@ -0,0 +1,6 @@ +class DeleteCachedSlugs < ActiveRecord::Migration + def change + remove_column Refinery::Blog::Category.table_name, :cached_slug + remove_column Refinery::Blog::Post.table_name, :cached_slug + end +end diff --git a/db/migrate/20120601151114_create_category_translations.rb b/db/migrate/20120601151114_create_category_translations.rb new file mode 100644 index 0000000..a7cb956 --- /dev/null +++ b/db/migrate/20120601151114_create_category_translations.rb @@ -0,0 +1,14 @@ +class CreateCategoryTranslations < ActiveRecord::Migration + def up + Refinery::Blog::Category.create_translation_table!({ + :title => :string, + :slug => :string + }, { + :migrate_data => true + }) + end + + def down + Refinery::Blog::Category.drop_translation_table! :migrate_data => true + end +end |