protector-globalize 0.0.1 → 0.0.2

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: ce46000f2bb7119be23cfc71617feecd0d83e22d
4
- data.tar.gz: 303d02be1a89efa2ec15450b46ee5d732eb39e79
3
+ metadata.gz: 6e7986f072dd8f372e41d4fd9282ddbe9d25e261
4
+ data.tar.gz: 5841e68a0ae0fb23453f9f1850f2319388d95d59
5
5
  SHA512:
6
- metadata.gz: c39c1029691c34f314b4415a4a5c228dcd698bbeb2e487192dfccf143c43f36f264634f28b6bceba09da13d81b4c1e546d4edaaf4a406c31d41d1f9918d48b7f
7
- data.tar.gz: be16c9e1ebea56811f07ac570181b24424a6a51852ce51000341d0617bc5f5e80a7e247791fce9dbbe555bcd6e0a3dfae3e82488522396ffefb670355a722b40
6
+ metadata.gz: af504760de08ca5331c35ed3a65d96b18b23bbfae6aeef3f2473f891e71bc804380b92c188f1ad917532932f117fff96e24d8396f75efb15218552a95a1f7b64
7
+ data.tar.gz: 0fa48580184a83b7ae882f0161d4be556b31798ac3a2817043e92c80c2d88b03e557eba3e1754fe98584518d361bffc8ca864613ff9f2ff63ca7c038ebe98c62
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Protector::Globalize
2
2
 
3
- TODO: Write a gem description
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Protector
2
2
  module Globalize
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  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.1
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-01-27 00:00:00.000000000 Z
11
+ date: 2014-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: protector