diff options
author | Marek <keraml@gmail.com> | 2011-05-19 01:11:45 +0200 |
---|---|---|
committer | Marek <keraml@gmail.com> | 2011-05-19 01:11:45 +0200 |
commit | 2d37cbf479ce809fa11760d65b48ace8de64591b (patch) | |
tree | b9bcd078e945bba4958eae8973d3f3999e311a8f /app | |
parent | 4cb096d2563016d73afdf4ed9c6fc54e79822dd7 (diff) | |
download | refinerycms-blog-2d37cbf479ce809fa11760d65b48ace8de64591b.tar.gz refinerycms-blog-2d37cbf479ce809fa11760d65b48ace8de64591b.tar.bz2 refinerycms-blog-2d37cbf479ce809fa11760d65b48ace8de64591b.zip |
Approximate ascii on blog slugs. For: GH-60
Diffstat (limited to 'app')
-rw-r--r-- | app/models/blog_category.rb | 5 | ||||
-rw-r--r-- | app/models/blog_post.rb | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/app/models/blog_category.rb b/app/models/blog_category.rb index bc0165a..d813655 100644 --- a/app/models/blog_category.rb +++ b/app/models/blog_category.rb @@ -7,7 +7,10 @@ class BlogCategory < ActiveRecord::Base validates :title, :presence => true, :uniqueness => true - has_friendly_id :title, :use_slug => true + has_friendly_id :title, :use_slug => true, + :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), + :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, true, :scoping => 'blog'), + :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, true, :scoping => 'blog') def post_count posts.select(&:live?).count diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index 63c66ba..224070d 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -21,7 +21,10 @@ class BlogPost < ActiveRecord::Base validates :title, :presence => true, :uniqueness => true validates :body, :presence => true - has_friendly_id :title, :use_slug => true + has_friendly_id :title, :use_slug => true, + :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), + :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, true, :scoping => 'blog'), + :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, true, :scoping => 'blog') scope :by_archive, lambda { |archive_date| where(['published_at between ? and ?', archive_date.beginning_of_month, archive_date.end_of_month]) |