Module: Notee::Helper

Defined in:
lib/notee/helper.rb

Instance Method Summary collapse

Instance Method Details

#get_all_noteesObject



3
4
5
# File 'lib/notee/helper.rb', line 3

def get_all_notees
  @notees = Notee::Post.where(status: 1)
end

#get_notee_by_id(id) ⇒ Object



20
21
22
23
# File 'lib/notee/helper.rb', line 20

def get_notee_by_id(id)
  return false unless id
  @notee = Notee::Post.find_by(id: id, status: 1)
end

#get_notee_by_slug(slug) ⇒ Object



25
26
27
28
# File 'lib/notee/helper.rb', line 25

def get_notee_by_slug(slug)
  return false unless slug
  @notee = Notee::Post.find_by(slug: slug, status: 1)
end

#get_notees_by_category_slug(category_slug) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/notee/helper.rb', line 11

def get_notees_by_category_slug(category_slug)

  return false unless category_slug
  category_id = Notee::Category.find_by(name: category_slug)
  return false unless category_id

  @notees = Notee::Post.where(category_id: category_id, status: 1)
end

#get_secret_noteesObject



7
8
9
# File 'lib/notee/helper.rb', line 7

def get_secret_notees
  @notees = Notee::Post.where(status: 2)
end