Skip to content

Commit

Permalink
Fix Page model to not rescue Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon de Andres committed Oct 9, 2012
1 parent 0281933 commit 55dc877
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions ubiquo_design/app/models/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def publish
UbiquoDesign.cache_manager.expire_page(self) if ActionController::Base.perform_caching
end
return true
rescue Exception => e
rescue StandardError => e
return false
end
end
Expand Down Expand Up @@ -267,17 +267,19 @@ def update_modified(save = false)
# Returns false if there are some problem saving page, creating
# block or relating widget.
def add_widget(block_key, widget)
transaction do
self.save! if self.new_record?
block = self.blocks.select { |b| b.block_type == block_key.to_s }.first
block ||= Block.create!(:page_id => self.id, :block_type => block_key.to_s)
block.widgets << widget
uhook_add_widget(widget) do
widget.save!
begin
transaction do
self.save! if self.new_record?
block = self.blocks.select { |b| b.block_type == block_key.to_s }.first
block ||= Block.create!(:page_id => self.id, :block_type => block_key.to_s)
block.widgets << widget
uhook_add_widget(widget) do
widget.save!
end
end
rescue StandardError => e
return false
end
rescue Exception => e
return false
end

private
Expand Down

0 comments on commit 55dc877

Please sign in to comment.