Skip to content

Commit

Permalink
don't save page when feed can't be generated
Browse files Browse the repository at this point in the history
  • Loading branch information
konto-andrzeja committed Jul 2, 2016
1 parent 18f4224 commit 733609c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/api/v1/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ def show

def create
@page = Page.new(page_params)
if @page.save && GenerateRss.new(@page).call
if GenerateRss.new(@page).call && @page.save
render json: @page
else
render json: @page.errors.full_messages, root: 'errors', status: :unprocessable_entity
end
end

def update
if page.update(page_params) && GenerateRss.new(page).call
if GenerateRss.new(page).call && page.update(page_params)
render json: page
else
render json: page.errors.full_messages, root: 'errors', status: :unprocessable_entity
Expand Down

0 comments on commit 733609c

Please sign in to comment.