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


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

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

.translatedObject


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

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

Instance Method Details

#post_countObject


26
27
28
# File 'app/models/refinery/blog/category.rb', line 26

def post_count
  posts.live.with_globalize.count
end