Sha256: afe8ec69304b697973cd64b6e9ab33902cfca0c8c6c2b2d38d5de5b051913e21
Contents?: true
Size: 1010 Bytes
Versions: 2
Compression:
Stored size: 1010 Bytes
Contents
module Notee module Helper def notees(search_txt) if search_txt.nil? # all_notees @notees = Notee::Post.where(status: Notee::STATUS[:published]).order(published_at: :desc) else # search_by_category_slug category_id = Notee::Category.find_by(slug: search_txt) category_id = Notee::Category.find_by(name: search_txt) unless category_id return false unless category_id @notees = Notee::Post.where(category_id: category_id, status: Notee::STATUS[:published]).order(published_at: :desc) end @notees end def secret_notees @notees = Notee::Post.where(status: Notee::STATUS[:secret_published]).order(published_at: :desc) end def notee(search_txt) return false unless search_txt @notee = Notee::Post.find_by(id: search_txt, status: Notee::STATUS[:published]) @notee = Notee::Post.find_by(slug: search_txt, status: Notee::STATUS[:published]) unless @notee @notee end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
notee-0.3.4.1 | lib/notee/helper.rb |
notee-0.3.4 | lib/notee/helper.rb |