Skip to content

Commit

Permalink
demoderate submissions on edit #14
Browse files Browse the repository at this point in the history
  • Loading branch information
zr2d2 committed Feb 21, 2012
1 parent 592b04d commit 5b627b8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/controllers/contents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def create
# PUT /contents/1.xml
def update
@content = Content.find(params[:id])
submissions = Submission.where(:content_id => params[:id])
submissions.each do |submission|
submission.update_attributes(:moderation_flag => nil)
end

respond_to do |format|
if @content.update_attributes(params[:content])
Expand Down

1 comment on commit 5b627b8

@bamnet
Copy link
Member

@bamnet bamnet commented on 5b627b8 Feb 22, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small notes:

submissions = @content.submissions instead of doing the where manually.

I'd move the code into the if @content.update_attributes... block so they only get demoderated if the content update succeeds.

Please sign in to comment.