templus_models 1.3.9 → 1.4.0

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: 3a928e5f6d63a6b07cb5141374333c9696443d36
4
- data.tar.gz: 68a4c26033c7e9cea6deecadaf07d8e4acd1c681
3
+ metadata.gz: 1609a99d6ec102a92d66a1145c45e96d8aa0a6ea
4
+ data.tar.gz: b89f00e0818d3e1d8059e0d89f7a3cdd6ea13b20
5
5
  SHA512:
6
- metadata.gz: 260315033d4e286744b3d462e03c8ab2f297feb894d047ed52a37d42f874de57f5d3d22850d1699079329c607a94b3a611b80fc207a4be13467135c3010ddef9
7
- data.tar.gz: f840e7e765a9a90b49060bac7d0fdb0a09ef8ef9d34e2df7b9e528447eca5251c6cd3486da227b6191a55bd2237e5e15ca674684576e6ae679756e4f1e7cc789
6
+ metadata.gz: 153364df16b09ec4e4587ae70f8f121d515ef439e0889afccb650a38b0f8e659950167276839f09ce3e7c1bf5f63d32f3789f132dea9185711469aafc2af9096
7
+ data.tar.gz: 615a5f1f132fd6d2cdb7034733df77f3293c8098f66b345da7df22ea080d2091476f86a3ae7cc9c84b929112557ce1eca8a4e33854c80a2d61ace4fc2f466c08
@@ -30,7 +30,7 @@ class CrudController < ApplicationController
30
30
  end
31
31
 
32
32
  def new
33
- authorize! :create, @model if respond_to?(:current_usuario)
33
+ authorize! :new, @model if respond_to?(:current_usuario)
34
34
  if params[:render] == "modal"
35
35
  if @model.reflect_on_association(params[:attribute].to_s).present?
36
36
  @model = @model.reflect_on_association(params[:attribute].to_s).class_name.constantize
@@ -43,18 +43,18 @@ class CrudController < ApplicationController
43
43
  end
44
44
 
45
45
  def edit
46
- authorize! :edit, @model if respond_to?(:current_usuario)
47
46
  @record = @model.find(params[:id])
47
+ authorize! :edit, @record if respond_to?(:current_usuario)
48
48
  end
49
49
 
50
50
  def show
51
- authorize! :read, @model if respond_to?(:current_usuario)
52
51
  @record = @model.find(params[:id])
52
+ authorize! :read, @record if respond_to?(:current_usuario)
53
53
  end
54
54
 
55
55
  def action
56
- authorize! :create_or_update, @model if respond_to?(:current_usuario)
57
56
  @record = @model.find(params[:id])
57
+ authorize! :create_or_update, @record if respond_to?(:current_usuario)
58
58
  if @model.method_defined?(params[:acao])
59
59
  if @record.send(params[:acao])
60
60
  flash.now[:success] = "Ação #{params[:acao]} efetuada com sucesso."
@@ -70,13 +70,14 @@ class CrudController < ApplicationController
70
70
  end
71
71
 
72
72
  def create
73
- authorize! :create, @model if respond_to?(:current_usuario)
74
73
  @saved = false
75
74
  if params[:id]
76
75
  @record = @model.find(params[:id])
76
+ authorize! :update, @record if respond_to?(:current_usuario)
77
77
  @saved = @record.update(params_permitt)
78
78
  else
79
79
  @record = @model.new(params_permitt)
80
+ authorize! :create, @record if respond_to?(:current_usuario)
80
81
  @saved = @record.save
81
82
  end
82
83
 
@@ -98,8 +99,8 @@ class CrudController < ApplicationController
98
99
  end
99
100
 
100
101
  def destroy
101
- authorize! :destroy, @model if respond_to?(:current_usuario)
102
102
  @record = @model.find(params[:id])
103
+ authorize! :destroy, @record if respond_to?(:current_usuario)
103
104
  if @record.destroy
104
105
  respond_to do |format|
105
106
  flash[:success] = "Cadastro removido com sucesso."
@@ -1,3 +1,3 @@
1
1
  module TemplusModels
2
- VERSION = "1.3.9"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -8,5 +8,5 @@
8
8
  <div class="col-sm-4 col-sm-offset-2">
9
9
  <%= f.submit "Salvar", class: 'btn btn-primary' %>
10
10
  </div>
11
- </div>
12
- <% end %>
11
+ </div>
12
+ <% 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.3.9
4
+ version: 1.4.0
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-08-25 00:00:00.000000000 Z
12
+ date: 2015-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -960,7 +960,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
960
960
  version: '0'
961
961
  requirements: []
962
962
  rubyforge_project:
963
- rubygems_version: 2.2.2
963
+ rubygems_version: 2.4.2
964
964
  signing_key:
965
965
  specification_version: 4
966
966
  summary: Easy CRUD generator for Rails Projects