diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/blog_post.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb index 5c0101d..914e112 100644 --- a/app/models/blog_post.rb +++ b/app/models/blog_post.rb @@ -21,7 +21,7 @@ class BlogPost < ActiveRecord::Base validates :title, :presence => true, :uniqueness => true validates :body, :presence => true - has_friendly_id :title, :use_slug => true, + has_friendly_id :friendly_id_source, :use_slug => true, :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en), :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => 'blog'), :strip_non_ascii => RefinerySetting.find_or_set(:strip_non_ascii, false, :scoping => 'blog') @@ -61,6 +61,10 @@ class BlogPost < ActiveRecord::Base }.compact end + def friendly_id_source + custom_url.present? ? custom_url : title + end + class << self def next current_record self.send(:with_exclusive_scope) do |