yodatra 0.3.7 → 0.3.8

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: 5e006ebdfb069d9c91cd2c9309627500a53292eb
4
- data.tar.gz: b1985c1d88db58d34ddcea1ab36dd34cc5c28f53
3
+ metadata.gz: a52754b7a6169ae899266b3e18672c7b2d1ec89d
4
+ data.tar.gz: 94e4985f0cbd1e7651a199b545a6bd4bc70da36b
5
5
  SHA512:
6
- metadata.gz: e49e4b3968858f06e20ba0593bc9231f4f0e114d86f1c4b8668ff44b6270a4bcf4daa09a427afe59da5a13229cedcb911d6f77e7a8084bf9a468d3790b4650b6
7
- data.tar.gz: f5ed3b5319b89f81b2977a583e625378b6c6e0139e1dc89ab6e3054a8938f72581795a8d39e5ce16d65861c86855f45656cdff165b220b4e35919fa79094d31c
6
+ metadata.gz: d5860fe9fd842c6503b3a664894ab94fd890faca960a32d9099d343c0673a99305e2a7a4af28ff601e9dd045afb35ecba5275de14d672aa72a6e9bd18a128b47
7
+ data.tar.gz: 5d7bef223457d35c365452e634457465c3a7d330a75a86aec2bb043d7d0bba74cf9569ae7f8deada69848444209f4446508d758063f830dc0827f6a415426f78
@@ -183,8 +183,8 @@ module Yodatra
183
183
  resource = nested? ? nested : model
184
184
 
185
185
  # Check access to the resource
186
- method = "prepare_#{action}"
187
- resource = send(method, resource) if respond_to? method
186
+ method = "limit_#{action}_for".to_sym
187
+ resource = model.send(method, resource, current_user) if respond_to?(method) && !current_user.nil?
188
188
 
189
189
  # ONE resource else COLLECTION
190
190
  one_id = nested? ? params[:captures].fourth : params[:captures].second if params[:captures].length == 4
@@ -208,6 +208,7 @@ module Yodatra
208
208
  end
209
209
 
210
210
  unless parent_model.nil?
211
+ parent_model = parent_model.limit_read_for parent_model, current_user if parent_model.respond_to?(:limit_read_for) && !current_user.nil?
211
212
  parent = parent_model.find params[:captures].second
212
213
  if parent.respond_to? :reflections
213
214
  # This is AR 4.0.x compatibility
@@ -1,3 +1,3 @@
1
1
  module Yodatra
2
- VERSION = '0.3.7'
2
+ VERSION = '0.3.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yodatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Bonaud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-16 00:00:00.000000000 Z
11
+ date: 2014-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack