Class: ZenCategory

Inherits:
ApplicationRecord show all
Includes:
RequiredUniqueName
Defined in:
app/models/zen_category.rb

Instance Method Summary collapse

Instance Method Details

#add_post(post) ⇒ Object

Parameters:



13
14
15
# File 'app/models/zen_category.rb', line 13

def add_post(post)
  post_zen_categories.create(post: post)
end

#post?(post) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)


8
9
10
# File 'app/models/zen_category.rb', line 8

def post?(post)
  post_zen_categories.where(post: post).exists?
end

#remove_post(post) ⇒ Object

Parameters:



18
19
20
# File 'app/models/zen_category.rb', line 18

def remove_post(post)
  post_zen_categories.where(post: post).destroy_all
end