Class: Refinery::Blog::Category

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/refinery/blog/category.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.by_title(title) ⇒ Object


15
16
17
# File 'app/models/refinery/blog/category.rb', line 15

def self.by_title(title)
  joins(:translations).find_by(title: title)
end

.translatedObject


19
20
21
# File 'app/models/refinery/blog/category.rb', line 19

def self.translated
  with_translations(::Globalize.locale)
end

Instance Method Details

#post_countObject


23
24
25
# File 'app/models/refinery/blog/category.rb', line 23

def post_count
  posts.live.with_globalize.count
end