forked from bofh/fetsite
AutoCommit Sam Aug 1 23:03:02 CEST 2015
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class Survey::Choice < ActiveRecord::Base
|
||||
belongs_to :question, class_name: 'Survey::Question'
|
||||
attr_accessible :picture, :sort, :text, :icon, :picture_cache, :remove_picture, :question_id
|
||||
has_many :answers, class_name: 'Survey::Answer'
|
||||
has_many :answers, class_name: 'Survey::Answer', dependent: :destroy
|
||||
include ActionView::Helpers::TagHelper
|
||||
mount_uploader :picture, PictureUploader
|
||||
def to_s
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Survey::Question < ActiveRecord::Base
|
||||
attr_accessible :text, :title, :typ, :choice_ids
|
||||
belongs_to :parent, polymorphic: true
|
||||
has_many :choices
|
||||
has_many :choices, dependent: :destroy
|
||||
has_many :answers, through: :choices
|
||||
include IsCommentable
|
||||
|
||||
@@ -22,7 +22,9 @@ class Survey::Question < ActiveRecord::Base
|
||||
cid= cid - found_ids
|
||||
Survey::Answer.where(user_id: user.id, choice_id: found_ids).delete_all
|
||||
else
|
||||
if self.typ == 0
|
||||
Survey::Answer.where(user_id: user.id, choice_id: self.choice_ids).delete_all
|
||||
end
|
||||
end
|
||||
cid.each do |c|
|
||||
if self.choice_ids.include?(c)
|
||||
|
||||
Reference in New Issue
Block a user