From 2d37cbf479ce809fa11760d65b48ace8de64591b Mon Sep 17 00:00:00 2001 From: Marek Date: Thu, 19 May 2011 01:11:45 +0200 Subject: Approximate ascii on blog slugs. For: GH-60 --- app/models/blog_category.rb | 5 ++++- app/models/blog_post.rb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'app') 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]) -- cgit v1.2.3