attr_initializable 0.1.0 → 0.1.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 +15 -0
- data/README.md +18 -2
- data/lib/attr_initializable.rb +0 -6
- data/lib/attr_initializable/version.rb +1 -1
- metadata +5 -9
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MjE2ZTQ4MGQ5NmY4Zjc2YTA5ZmE2YjRmYmU1M2QxZTAwNmU2OGZiMA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MjFiM2JmNjY5YjI0NzFiM2E4M2VjOWY4MjVjMjY3YTUxZDdjYzFmNA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MGU2ZTJmNGRmMTM3NmI1MzI2ZjhjMGRmN2NjM2YwNWFjYWNlZmRkYzJmOGI2
|
10
|
+
YjRmYjFkZjY5YzlkMTczZmU5YTRiYmQ0MjI2MDY4YjhjNjBkNzNjNDgzNjcx
|
11
|
+
YTc1MjMzMGUzNzI1ZDM3YzNlYzVjOGE0YWEzMzYyYzEwZGQzN2U=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZTZlYWIzMWJlMTVjNDU5ZTYzYTViNTYzMzUzMDU1YjIzYWVkM2ZhYmE3NWYx
|
14
|
+
YmQ2MmM5OTJhYzJiMWU3NzE4MTU5MDVhODRiZGU0ODMxZjE3MWJkYzA1MjZi
|
15
|
+
YTJkYTUxZmYzZGU3MDI0Mjg0ODY5M2VlYTQyZjdjM2Q1YWRkN2M=
|
data/README.md
CHANGED
@@ -6,14 +6,30 @@
|
|
6
6
|
|
7
7
|
Rails plugin that provides `attr_initializable` helper to declare read-only attributes that can be mass-assigned at model creation time
|
8
8
|
|
9
|
-
#
|
9
|
+
# Active Record support
|
10
10
|
|
11
|
-
Works with
|
11
|
+
Works with Active Record 3.2.x natively and Active Record 4.0.x with `protected_attributes` compatibility gem.
|
12
12
|
|
13
13
|
# Installation
|
14
14
|
|
15
15
|
Add `gem 'attr_initializable'` to your Rails' `Gemfile` and run `bundle install`.
|
16
16
|
|
17
|
+
# Development notes
|
18
|
+
|
19
|
+
## Running tests
|
20
|
+
|
21
|
+
To run tests under Active Record 3.2.x:
|
22
|
+
|
23
|
+
```bash
|
24
|
+
BUNDLE_GEMFILE=Gemfile.rails3 rake
|
25
|
+
```
|
26
|
+
|
27
|
+
To run tests under Active Record 4.0.x:
|
28
|
+
|
29
|
+
```bash
|
30
|
+
BUNDLE_GEMFILE=Gemfile.rails4 rake
|
31
|
+
```
|
32
|
+
|
17
33
|
# Licence
|
18
34
|
|
19
35
|
`attr_initializable` is released under the MIT licence.
|
data/lib/attr_initializable.rb
CHANGED
@@ -8,12 +8,6 @@ module AttrInitializable
|
|
8
8
|
'Please add `protected_attributes` to your Gemfile to use `attr_initializable`.')
|
9
9
|
end
|
10
10
|
|
11
|
-
unless ActiveRecord::Base.respond_to?('_mass_assignment_sanitizer') &&
|
12
|
-
ActiveRecord::Base.send('_mass_assignment_sanitizer').is_a?(ActiveModel::MassAssignmentSecurity::StrictSanitizer)
|
13
|
-
puts "WARNING: Running with strict mass assignment sanitizer is recommended.\n" \
|
14
|
-
"Please add config.active_record.mass_assignment_sanitizer = :strict to config/application.rb.\n"
|
15
|
-
end
|
16
|
-
|
17
11
|
role = options.delete(:as) || :default
|
18
12
|
initializable_attributes[role] ||= []
|
19
13
|
initializable_attributes[role] += Array(attributes)
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_initializable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Richard Cook
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-18 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activerecord
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -25,7 +23,6 @@ dependencies:
|
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
25
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
26
|
requirements:
|
30
27
|
- - ! '>='
|
31
28
|
- !ruby/object:Gem::Version
|
@@ -55,27 +52,26 @@ files:
|
|
55
52
|
homepage: https://github.com/rcook/attr_initializable/
|
56
53
|
licenses:
|
57
54
|
- MIT
|
55
|
+
metadata: {}
|
58
56
|
post_install_message:
|
59
57
|
rdoc_options: []
|
60
58
|
require_paths:
|
61
59
|
- lib
|
62
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
61
|
requirements:
|
65
62
|
- - ! '>='
|
66
63
|
- !ruby/object:Gem::Version
|
67
64
|
version: '0'
|
68
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
66
|
requirements:
|
71
67
|
- - ! '>='
|
72
68
|
- !ruby/object:Gem::Version
|
73
69
|
version: '0'
|
74
70
|
requirements: []
|
75
71
|
rubyforge_project:
|
76
|
-
rubygems_version: 1.
|
72
|
+
rubygems_version: 2.1.11
|
77
73
|
signing_key:
|
78
|
-
specification_version:
|
74
|
+
specification_version: 4
|
79
75
|
summary: attr_initializable
|
80
76
|
test_files:
|
81
77
|
- test/test_helper.rb
|