aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/refinery/blog/category.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/refinery/blog/category.rb')
-rw-r--r--app/models/refinery/blog/category.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/models/refinery/blog/category.rb b/app/models/refinery/blog/category.rb
index 2935c89..36e6816 100644
--- a/app/models/refinery/blog/category.rb
+++ b/app/models/refinery/blog/category.rb
@@ -1,8 +1,11 @@
module Refinery
module Blog
class Category < ActiveRecord::Base
+
+ translates :title, :slug
+
extend FriendlyId
- friendly_id :title, :use => [:slugged]
+ friendly_id :title, :use => [:slugged, :globalize]
has_many :categorizations, :dependent => :destroy, :foreign_key => :blog_category_id
has_many :posts, :through => :categorizations, :source => :blog_post
@@ -12,9 +15,18 @@ module Refinery
validates :title, :presence => true, :uniqueness => true
attr_accessible :title
+ attr_accessor :locale
+
+ class Translation
+ attr_accessible :locale
+ end
+
+ def self.translated
+ with_translations(::Globalize.locale)
+ end
def post_count
- posts.live.count
+ posts.live.with_globalize.count
end
# how many items to show per page