diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/assets_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/nodes_controller.rb | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index 03780c69..801e0968 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb | |||
| @@ -94,7 +94,7 @@ class AssetsController < ApplicationController | |||
| 94 | format.xml { head :ok } | 94 | format.xml { head :ok } |
| 95 | end | 95 | end |
| 96 | rescue ActiveRecord::RecordInvalid => e | 96 | rescue ActiveRecord::RecordInvalid => e |
| 97 | flash[:error] = e.message | 97 | flash[:error] = e.record.errors.full_messages.to_sentence |
| 98 | respond_to do |format| | 98 | respond_to do |format| |
| 99 | format.html { redirect_to(asset_path(@asset)) } | 99 | format.html { redirect_to(asset_path(@asset)) } |
| 100 | format.xml { head :forbidden } | 100 | format.xml { head :forbidden } |
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index 383fb72c..ca30976f 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb | |||
| @@ -163,7 +163,7 @@ class NodesController < ApplicationController | |||
| 163 | flash[:error] = t("flash.common.locked_by_other") | 163 | flash[:error] = t("flash.common.locked_by_other") |
| 164 | redirect_to node_path(@node) | 164 | redirect_to node_path(@node) |
| 165 | rescue ActiveRecord::RecordInvalid => e | 165 | rescue ActiveRecord::RecordInvalid => e |
| 166 | flash[:error] = e.message | 166 | flash[:error] = e.record.errors.full_messages.to_sentence |
| 167 | redirect_to node_path(@node) | 167 | redirect_to node_path(@node) |
| 168 | end | 168 | end |
| 169 | 169 | ||
| @@ -176,7 +176,7 @@ class NodesController < ApplicationController | |||
| 176 | flash[:error] = t("flash.nodes.restore_target_missing") | 176 | flash[:error] = t("flash.nodes.restore_target_missing") |
| 177 | redirect_to node_path(@node) | 177 | redirect_to node_path(@node) |
| 178 | rescue ActiveRecord::RecordInvalid => e | 178 | rescue ActiveRecord::RecordInvalid => e |
| 179 | flash[:error] = e.message | 179 | flash[:error] = e.record.errors.full_messages.to_sentence |
| 180 | redirect_to node_path(@node) | 180 | redirect_to node_path(@node) |
| 181 | end | 181 | end |
| 182 | 182 | ||
| @@ -186,7 +186,8 @@ class NodesController < ApplicationController | |||
| 186 | redirect_to trashed_nodes_path | 186 | redirect_to trashed_nodes_path |
| 187 | 187 | ||
| 188 | rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotDestroyed => e | 188 | rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotDestroyed => e |
| 189 | flash[:error] = e.message | 189 | messages = e.record.errors.full_messages |
| 190 | flash[:error] = messages.any? ? messages.to_sentence : e.message | ||
| 190 | redirect_to node_path(@node) | 191 | redirect_to node_path(@node) |
| 191 | end | 192 | end |
| 192 | 193 | ||
| @@ -195,7 +196,7 @@ class NodesController < ApplicationController | |||
| 195 | flash[:notice] = t("flash.nodes.published") | 196 | flash[:notice] = t("flash.nodes.published") |
| 196 | redirect_to node_path(@node) | 197 | redirect_to node_path(@node) |
| 197 | rescue ActiveRecord::RecordInvalid => e | 198 | rescue ActiveRecord::RecordInvalid => e |
| 198 | flash[:error] = e.message | 199 | flash[:error] = e.record.errors.full_messages.to_sentence |
| 199 | redirect_to node_path(@node) | 200 | redirect_to node_path(@node) |
| 200 | end | 201 | end |
| 201 | 202 | ||
