protected_attributes 1.1.3 → 1.1.4
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 +4 -4
- data/LICENSE.txt +2 -2
- data/README.md +1 -1
- data/lib/active_record/mass_assignment_security/nested_attributes.rb +6 -2
- data/lib/protected_attributes/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2ce4f8f51e6f3db2f77a83f05ac9f8324f66e241
|
|
4
|
+
data.tar.gz: 9b2fc7832f70e8a406c1fef5c0ef5a60f326a38a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ac6bc021dc2e68161e8a7a774ba7f498a0b2d3e218cf456ba2d3b191723714a06eccbb74a8e7832bf81202f3f8f4443db4f78bd83814e34ca15be2e75b45925c
|
|
7
|
+
data.tar.gz: e5b6680fb9e5c887fee649f73f6e6bb824ef11d9739f8c648c34e949d303fb54ceea92c4373472f1144fea7529b6c314115069729c670d2559ec7b218085637c
|
data/LICENSE.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c) 2012 Guillermo Iguaran
|
|
1
|
+
Copyright (c) 2012-2017 Guillermo Iguaran
|
|
2
2
|
|
|
3
3
|
MIT License
|
|
4
4
|
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -38,7 +38,7 @@ attr_accessible :name
|
|
|
38
38
|
attr_accessible :name, :is_admin, :as => :admin
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
If you want to set a protected attribute, you will
|
|
41
|
+
If you want to set a protected attribute, you will have to assign it individually:
|
|
42
42
|
|
|
43
43
|
```ruby
|
|
44
44
|
params[:user] # => {:name => "owned", :is_admin => true}
|
|
@@ -15,7 +15,11 @@ module ActiveRecord
|
|
|
15
15
|
|
|
16
16
|
attr_names.each do |association_name|
|
|
17
17
|
if reflection = reflect_on_association(association_name)
|
|
18
|
-
|
|
18
|
+
if active_record_40?
|
|
19
|
+
reflection.options[:autosave] = true
|
|
20
|
+
else
|
|
21
|
+
reflection.autosave = true
|
|
22
|
+
end
|
|
19
23
|
add_autosave_association_callbacks(reflection)
|
|
20
24
|
|
|
21
25
|
nested_attributes_options = self.nested_attributes_options.dup
|
|
@@ -87,7 +91,7 @@ module ActiveRecord
|
|
|
87
91
|
end
|
|
88
92
|
|
|
89
93
|
if limit && attributes_collection.size > limit
|
|
90
|
-
raise TooManyRecords, "Maximum #{limit} records are allowed. Got #{attributes_collection.size} records instead."
|
|
94
|
+
raise ::ActiveRecord::NestedAttributes::TooManyRecords, "Maximum #{limit} records are allowed. Got #{attributes_collection.size} records instead."
|
|
91
95
|
end
|
|
92
96
|
end
|
|
93
97
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: protected_attributes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-05-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
164
164
|
version: '0'
|
|
165
165
|
requirements: []
|
|
166
166
|
rubyforge_project:
|
|
167
|
-
rubygems_version: 2.
|
|
167
|
+
rubygems_version: 2.5.2
|
|
168
168
|
signing_key:
|
|
169
169
|
specification_version: 4
|
|
170
170
|
summary: Protect attributes from mass assignment in Active Record models
|