aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2012-02-27 17:08:37 +1300
committerPhilip Arndt <parndt@gmail.com>2012-02-27 17:08:37 +1300
commit594dd8ca96f9a0e06dd28d2176653855e39a43e2 (patch)
treedbac325e354b3266428fd0444a708173766266fa /app
parent837ddfe42bfd906f79e2a28608dd6af988511e64 (diff)
downloadrefinerycms-blog-594dd8ca96f9a0e06dd28d2176653855e39a43e2.tar.gz
refinerycms-blog-594dd8ca96f9a0e06dd28d2176653855e39a43e2.tar.bz2
refinerycms-blog-594dd8ca96f9a0e06dd28d2176653855e39a43e2.zip
Now supporting FriendlyId 4
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