simon_says 0.3.0.alpha.4 → 0.3.0.alpha.5

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
  SHA256:
3
- metadata.gz: 2ebffb1d29f995636c2c9997b8e86a795b4a7ec08cc9dfcd6fd1bca31463203c
4
- data.tar.gz: 0fb849d27ded008910437acd78b9470975b436702f917a52ae101f7ef6a0e2f9
3
+ metadata.gz: 3abfdc67fe4a00391a5a167d425db7cda7e855c316b00a724d1f452114af6c68
4
+ data.tar.gz: c14a9de36943db2c6059b8ea6a41063ad99a704a0964c38600a99ebb3687a170
5
5
  SHA512:
6
- metadata.gz: cdb55a962f39d5d0df49579a37cf997e4acba5fc41e375429ff38b2ffcaadd6b9377861e661ab573833f4fe8fe58eb9981ae9b8ab5c9ed5d5f7655290c9e022c
7
- data.tar.gz: ea2a382c7226db07795804807280ee24e4c834bb9d7316a3122c62c718cea195a61a45504668150f208ed420f8b0f34a5613f5facc3bfe11a94397eeb244ff5e
6
+ metadata.gz: ac1930289951138e3bee481d6f09a44b3f5b3878e4b19685167614add7ceff33e1ebb409ec67f382dd3985ba9970373ff3ddac316b97b82443c383d16bc3a7b6
7
+ data.tar.gz: 9be3fd968195386735821c2ab17b02ce59de685788ad54cc5ded492368e6c2bc2e92f36f77a4b61c1924a78d052ca7b1d0283770957ed8702651f89968839108
@@ -6,7 +6,9 @@ module SimonSays
6
6
  # @private
7
7
  def initialize(as, required, actual)
8
8
  # TODO i18n for err message (as should be singluarized with 1 flag)
9
- super "Access denied; #{required * ', '} role is required. Current access is #{actual * ', '}"
9
+ current_access = actual.empty? ? 'empty' : actual.join(', ')
10
+
11
+ super "Access denied; #{required * ', '} #{as} is required. Current access is #{current_access}"
10
12
  end
11
13
  end
12
14
 
@@ -145,7 +147,8 @@ module SimonSays
145
147
  scope, query = resource_scope_and_query(resource, options)
146
148
  through = options[:through] ? options[:through].to_s : nil
147
149
 
148
- assoc = through || (options[:from] ? resource.pluralize : nil)
150
+ assoc_name = through || (options[:from] ? resource.pluralize : nil)
151
+ assoc = Authorizer.association_method(assoc_name)
149
152
  scope = scope.send(assoc) if assoc && scope.respond_to?(assoc)
150
153
 
151
154
  record = scope.where(query).first!
@@ -195,6 +198,13 @@ module SimonSays
195
198
  end
196
199
  end
197
200
 
201
+ def self.association_method(assoc)
202
+ return if assoc.nil?
203
+ return :"#{assoc}_dataset" if defined? Sequel
204
+
205
+ assoc.to_sym
206
+ end
207
+
198
208
  private
199
209
 
200
210
  # @private
@@ -1,3 +1,3 @@
1
1
  module SimonSays
2
- VERSION = '0.3.0.alpha.4'
2
+ VERSION = '0.3.0.alpha.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simon_says
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.alpha.4
4
+ version: 0.3.0.alpha.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Coyne
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-07-12 00:00:00.000000000 Z
13
+ date: 2019-07-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport