Skip to content

Commit

Permalink
make sure update is successful before demoderating #14
Browse files Browse the repository at this point in the history
  • Loading branch information
zr2d2 committed Feb 22, 2012
1 parent 4251a06 commit a9ba8a3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/controllers/contents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ 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])
submissions = @content.submissions
submissions.each do |submission|
submission.update_attributes(:moderation_flag => nil)
end
format.html { redirect_to(@content, :notice => t(:content_updated)) }
format.xml { head :ok }
else
Expand Down

0 comments on commit a9ba8a3

Please sign in to comment.