Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ViditChitkara committed Feb 4, 2018
1 parent 11ec4ca commit 7d7c326
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/answers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def delete
current_user.role == 'admin' ||
current_user.role == 'moderator'
respond_to do |format|
if @answer.delete
if @answer.destroy
format.html { redirect_to @answer.node.path(:question), notice: 'Answer deleted' }
format.js
else
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def update
def delete
@node = Node.find(params[:id])
if current_user.uid == @node.uid && @node.type == 'note' || current_user.role == 'admin' || current_user.role == 'moderator'
@node.delete
@node.destroy
respond_with do |format|
format.html do
if request.xhr?
Expand Down
2 changes: 1 addition & 1 deletion app/models/answer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Answer < ActiveRecord::Base
belongs_to :node, foreign_key: 'nid', dependent: :destroy
belongs_to :drupal_user, foreign_key: 'uid'
has_many :answer_selections, foreign_key: 'aid'
has_many :comments, foreign_key: 'aid'
has_many :comments, foreign_key: 'aid', dependent: :destroy

validates :content, presence: true

Expand Down
2 changes: 1 addition & 1 deletion app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def parent
if aid == 0
node
else
answer && answer.node
return answer.node unless answer.nil?
end
end

Expand Down

0 comments on commit 7d7c326

Please sign in to comment.