protector-globalize 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -5
- data/lib/protector/globalize.rb +13 -1
- data/lib/protector/globalize/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e7986f072dd8f372e41d4fd9282ddbe9d25e261
|
4
|
+
data.tar.gz: 5841e68a0ae0fb23453f9f1850f2319388d95d59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af504760de08ca5331c35ed3a65d96b18b23bbfae6aeef3f2473f891e71bc804380b92c188f1ad917532932f117fff96e24d8396f75efb15218552a95a1f7b64
|
7
|
+
data.tar.gz: 0fa48580184a83b7ae882f0161d4be556b31798ac3a2817043e92c80c2d88b03e557eba3e1754fe98584518d361bffc8ca864613ff9f2ff63ca7c038ebe98c62
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Protector::Globalize
|
2
2
|
|
3
|
-
|
3
|
+
Globalize has some internal issues when used in conjuction with Protector due to the way it creates instances of localization sub-model. Basically you won't be able to save any restricted model – validations will always fail. This gem will make things work as intended.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -16,10 +16,6 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install protector-globalize
|
18
18
|
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
22
|
-
|
23
19
|
## Contributing
|
24
20
|
|
25
21
|
1. Fork it
|
data/lib/protector/globalize.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'protector/globalize/version'
|
2
|
-
require 'protector'
|
3
2
|
require 'globalize'
|
3
|
+
require 'protector'
|
4
4
|
|
5
5
|
module Globalize
|
6
6
|
module ActiveRecord
|
@@ -13,5 +13,17 @@ module Globalize
|
|
13
13
|
|
14
14
|
alias_method_chain :save_translations!, :protector
|
15
15
|
end
|
16
|
+
|
17
|
+
module InstanceMethods
|
18
|
+
def read_attribute_with_protector(name, options = {})
|
19
|
+
return nil if protector_subject? && !can?(:read, name)
|
20
|
+
|
21
|
+
Protector.insecurely do
|
22
|
+
read_attribute_without_protector(name, options)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
alias_method_chain :read_attribute, :protector
|
27
|
+
end
|
16
28
|
end
|
17
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protector-globalize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Staal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: protector
|