Class: Feedback

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Includes:
Likeable
Defined in:
app/models/feedback.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#positiveObject

Returns the value of attribute positive.



27
28
29
# File 'app/models/feedback.rb', line 27

def positive
  @positive
end

Instance Method Details

#category_ids=(ids) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/models/feedback.rb', line 29

def category_ids=(ids)
  categories.select{|c| !ids.map(&:to_i).include?(c.id)}.each do |category|
    categories.delete category
  end
  
  category_ids = categories.where('community_categories.id IN(?)', ids).map(&:id)
  
  ids.each do |category_id|
    next if category_ids.include? category_id.to_i
      
    categories << CommunityCategory.find(category_id)
  end
end