templus_models 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f05fe347b6754ab181b55d2a1c2b664d0998700d
4
- data.tar.gz: 5e7c69d642e70080dbffa76d7fc7302aa37f61f5
3
+ metadata.gz: 5416eadc5dfb02b33423613e21ecd0d4112b64d1
4
+ data.tar.gz: 4ed46660ad993f61e05a08d8690bcb3e413db680
5
5
  SHA512:
6
- metadata.gz: d9dc659f095c0ece74d165a71d569b8b1ab72afdc17ec7641ad1bf1dc2d8ad497c741de39f0d8fd46218a45df1fc6b711a0a846771ee5b5e8c3f4e39014795fe
7
- data.tar.gz: c718ed02cbaae3c7ab28ef6e168a14a178f0732707ffce44b5b63de168b2cdd6e9d24d12483c98c5938c61cc6128f01caab8bbd038bc3c84d683d5d3aab40e67
6
+ metadata.gz: 07e8a4ca8cbd5561af6a8892ecd279a54ebacdfaa6c887f578846bc7a00a8be32e38e5a26bccfb565dbf259fa67bf263c6d8e1733a1ea7cfaab5d05f155b8066
7
+ data.tar.gz: f57354012a1de695d90378856005f381345fc671a5a12200ea17bcc4db40f03e39a3cb2c8985a86cb81437173cd7a1f4b1a2c0b73c8f5e32f922119383721b31
@@ -92,11 +92,18 @@ class CrudController < ApplicationController
92
92
  def destroy
93
93
  authorize! :destroy, @model if respond_to?(:current_usuario)
94
94
  @record = @model.find(params[:id])
95
- @record.destroy
96
- respond_to do |format|
97
- flash[:success] = "Cadastro removido com sucesso."
98
- format.html { redirect_to "/crud/#{@model.name.underscore}" }
99
- format.js { render action: :index }
95
+ if @record.destroy
96
+ respond_to do |format|
97
+ flash[:success] = "Cadastro removido com sucesso."
98
+ format.html { redirect_to "/crud/#{@model.name.underscore}" }
99
+ format.js { render action: :index }
100
+ end
101
+ else
102
+ respond_to do |format|
103
+ flash[:error] = @record.errors.full_messages.join(", ")
104
+ format.html { redirect_to "/crud/#{@model.name.underscore}" }
105
+ format.js { render action: :index }
106
+ end
100
107
  end
101
108
  end
102
109
 
@@ -1,3 +1,3 @@
1
1
  module TemplusModels
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: templus_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Sol
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-05 00:00:00.000000000 Z
12
+ date: 2015-05-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails