templus_models 1.5.10 → 1.5.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dec26dfc7240381e3ba068b510a02b9765e23d69
4
- data.tar.gz: 917dab50289ff467c0e4d3693efe7c36f0899cfa
3
+ metadata.gz: b1536520578bce0358a6fd84f1b85709011495fa
4
+ data.tar.gz: f32ca636fb1f375659b657d8f99584124507fb6a
5
5
  SHA512:
6
- metadata.gz: ea400e28d502b904366c3456fa2494f60f9266915734ef94d20519b5522a9ce1495f9c6ef6f3bef78d3ba0eb5e1b093369dd2aabc7b9d23f56b118c6b5a141a7
7
- data.tar.gz: 7ebc7b1c648d203a0719294db80612a297172e8b4c88d27b35afdcec89baa3a2cb035e5ba98baae96f15655d2fe6c471ed956d147fa322c696130525bb80639a
6
+ metadata.gz: 26af92dfbe251974f8fbd0aa35633034fb96960b3cfbe0e50fb8b07c702ad3dab8dd4a9fe8d8a0d4af723dce16402973004d2f5b0b1e0335b4eea4dbde699d42
7
+ data.tar.gz: ee1fd4987306a8b1f734bc6a69ffed10770698b502ab3013a3b769d18d1128895fadceb71beee01876720fae4d082a74920c9d760fad7d4f9681462f608fcca9
@@ -8,10 +8,12 @@ class CrudController < ApplicationController
8
8
  @model = Module.const_get(params[:model].camelize).find(params[:id]).send(params[:associacao])
9
9
  c_helper = Module.const_get(params[:model].camelize).reflect_on_association(params[:associacao]).class_name
10
10
  @crud_helper = Module.const_get("#{c_helper}Crud") unless params[:render] == "modal" and params[:action] == "new"
11
+ @model_permission = c_helper.constantize
11
12
  @url = "/crud/#{params[:model]}/#{params[:id]}/#{params[:associacao]}"
12
13
  @id = params[:associacao_id] if params[:associacao_id]
13
14
  else
14
15
  @model = Module.const_get(params[:model].camelize)
16
+ @model_permission = @model
15
17
  @crud_helper = Module.const_get("#{params[:model]}_crud".camelize) unless params[:render] == "modal" and params[:action] == "new"
16
18
  @url = "/crud/#{params[:model]}"
17
19
  @id = params[:id] if params[:id]
@@ -20,7 +22,7 @@ class CrudController < ApplicationController
20
22
 
21
23
  public
22
24
  def index
23
- authorize! :read, @model if respond_to?(:current_usuario)
25
+ authorize! :read, @model_permission if respond_to?(:current_usuario)
24
26
  if params[:scope].present?
25
27
  @q = @model.send(params[:scope]).search(params[:q])
26
28
  else
@@ -49,10 +51,11 @@ class CrudController < ApplicationController
49
51
  else
50
52
  @model = params[:attribute].to_s.camelcase.constantize
51
53
  end
54
+ @model_permission = @model
52
55
  @url = "/crud/#{@model.name.underscore}"
53
56
  @crud_helper = Module.const_get("#{@model}Crud".camelize)
54
57
  end
55
- authorize! :new, @model if respond_to?(:current_usuario)
58
+ authorize! :new, @model_permission if respond_to?(:current_usuario)
56
59
  @record = @model.new
57
60
  end
58
61
 
@@ -91,7 +94,7 @@ class CrudController < ApplicationController
91
94
  @saved = @record.update(params_permitt)
92
95
  else
93
96
  @record = @model.new(params_permitt)
94
- authorize! :create, @model if respond_to?(:current_usuario)
97
+ authorize! :create, @model_permission if respond_to?(:current_usuario)
95
98
  @saved = @record.save
96
99
  end
97
100
 
@@ -131,7 +134,7 @@ class CrudController < ApplicationController
131
134
  end
132
135
 
133
136
  def query
134
- authorize! :read, @model if respond_to?(:current_usuario)
137
+ authorize! :read, @model_permission if respond_to?(:current_usuario)
135
138
  @resource = @model
136
139
  @q = @resource.search(params[:q])
137
140
  @q.sorts = 'updated_at desc' if @q.sorts.empty?
@@ -1,3 +1,3 @@
1
1
  module TemplusModels
2
- VERSION = "1.5.10"
2
+ VERSION = "1.5.11"
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.5.10
4
+ version: 1.5.11
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-12-14 00:00:00.000000000 Z
12
+ date: 2016-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails