aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/refinery/blog/category.rb7
-rw-r--r--app/models/refinery/blog/post.rb7
2 files changed, 4 insertions, 10 deletions
diff --git a/app/models/refinery/blog/category.rb b/app/models/refinery/blog/category.rb
index 55557c5..05e6994 100644
--- a/app/models/refinery/blog/category.rb
+++ b/app/models/refinery/blog/category.rb
@@ -1,6 +1,8 @@
module Refinery
module Blog
class Category < ActiveRecord::Base
+ extend FriendlyId
+ friendly_id :title, :use => [:slugged]
has_many :categorizations, :dependent => :destroy, :foreign_key => :blog_category_id
has_many :posts, :through => :categorizations, :source => :blog_post
@@ -9,11 +11,6 @@ module Refinery
validates :title, :presence => true, :uniqueness => true
- has_friendly_id :title, :use_slug => true,
- :default_locale => (Refinery::I18n.default_frontend_locale rescue :en),
- :approximate_ascii => Refinery::Blog.approximate_ascii,
- :strip_non_ascii => Refinery::Blog.strip_non_ascii
-
def post_count
posts.select(&:live?).count
end
diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb
index 75911b9..b078272 100644
--- a/app/models/refinery/blog/post.rb
+++ b/app/models/refinery/blog/post.rb
@@ -4,6 +4,8 @@ require 'seo_meta'
module Refinery
module Blog
class Post < ActiveRecord::Base
+ extend FriendlyId
+ friendly_id :friendly_id_source, :use => [:slugged]
is_seo_meta if self.table_exists?
@@ -28,11 +30,6 @@ module Refinery
:allow_blank => true,
:verify => [:resolve_redirects]}
- has_friendly_id :friendly_id_source, :use_slug => true,
- :default_locale => (Refinery::I18n.default_frontend_locale rescue :en),
- :approximate_ascii => Refinery::Blog.approximate_ascii,
- :strip_non_ascii => Refinery::Blog.strip_non_ascii
-
attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url, :author
attr_accessible :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids
attr_accessible :source_url, :source_url_title