activerecord-has_one_defaults 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +18 -1
- data/CHANGELOG.md +20 -0
- data/CONTRIBUTING.md +28 -0
- data/README.md +3 -3
- data/activerecord-has_one_defaults.gemspec +2 -0
- data/gemfiles/rails-5.1.rb +5 -0
- data/gemfiles/rails-5.2.rb +5 -0
- data/gemfiles/rails-6.0.rb +6 -0
- data/lib/activerecord/has_one_defaults.rb +1 -1
- data/lib/activerecord/has_one_defaults/version.rb +1 -1
- metadata +28 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e11049e32b5c0b72ccbd0d7fe78443cab590518fd3c94725cab7fb801702ef8d
|
4
|
+
data.tar.gz: 9d3c91ea70e81a8cb64b28ebc31f7928ca5a263ed6e8d8e7f5ea5586da9530c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1cbc9c0cd0047555e3b552987910e1ed8c10813f0d3b78395c22891315ee3f1a01f8be66b1a64104ef38a4a4048d0800c9ae685584f58f5d636d70d8f4b375b
|
7
|
+
data.tar.gz: c0fd72d2cc61e158a36a1db2a4dcb826c2232f643a8b8c38c497487d10b7553b6ccfa5115df649930cba1ab9c6220c6538556dc75111e06517757d8375868d06
|
data/.travis.yml
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
|
3
5
|
rvm:
|
4
6
|
- 2.3.1
|
5
|
-
|
7
|
+
- 2.5.1
|
8
|
+
|
9
|
+
gemfile:
|
10
|
+
- gemfiles/rails-5.1.rb
|
11
|
+
- gemfiles/rails-5.2.rb
|
12
|
+
- gemfiles/rails-6.0.rb
|
13
|
+
|
14
|
+
before_install:
|
15
|
+
- gem update --system
|
16
|
+
- gem update bundler
|
17
|
+
|
18
|
+
matrix:
|
19
|
+
exclude:
|
20
|
+
# rails 6 will not support ruby < 2.4.1
|
21
|
+
- rvm: 2.3.1
|
22
|
+
gemfile: gemfiles/rails-6.0.rb
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [0.1.1] (2018-11-07)
|
9
|
+
|
10
|
+
* Breaking Changes
|
11
|
+
* None
|
12
|
+
* Added
|
13
|
+
* Contributing.md
|
14
|
+
* Testing with Rails 5.2, Rails 6.0, Ruby 2.5
|
15
|
+
* Fixed
|
16
|
+
* Fix compatability with Rails 5.2
|
17
|
+
|
18
|
+
## 0.1.0
|
19
|
+
|
20
|
+
* Initial Release
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Contributing to ActiveRecord-has_one_defaults
|
2
|
+
|
3
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/GoodMeasuresLLC/activerecord-has_one_defaults. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
4
|
+
|
5
|
+
## Issues
|
6
|
+
|
7
|
+
Please use github issues for bug reports and feature suggestions.
|
8
|
+
|
9
|
+
## Development
|
10
|
+
|
11
|
+
### Testing
|
12
|
+
|
13
|
+
Tests can be run against different versions of Rails:
|
14
|
+
|
15
|
+
```
|
16
|
+
BUNDLE_GEMFILE=gemfiles/rails-5.1.rb bundle install
|
17
|
+
BUNDLE_GEMFILE=gemfiles/rails-5.1.rb bundle exec rake
|
18
|
+
```
|
19
|
+
|
20
|
+
```
|
21
|
+
BUNDLE_GEMFILE=gemfiles/rails-5.2.rb bundle install
|
22
|
+
BUNDLE_GEMFILE=gemfiles/rails-5.2.rb bundle exec rake
|
23
|
+
```
|
24
|
+
|
25
|
+
```
|
26
|
+
BUNDLE_GEMFILE=gemfiles/rails-6.0.rb bundle install
|
27
|
+
BUNDLE_GEMFILE=gemfiles/rails-6.0.rb bundle exec rake
|
28
|
+
```
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ built.
|
|
42
42
|
User.new.neck
|
43
43
|
# #<Neck:0x007fb2f4c68fc8> {}
|
44
44
|
|
45
|
-
User.address
|
45
|
+
User.new.address
|
46
46
|
# nil
|
47
47
|
|
48
48
|
User.new.profile
|
@@ -62,7 +62,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
62
62
|
|
63
63
|
## Contributing
|
64
64
|
|
65
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
65
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/GoodMeasuresLLC/activerecord-has_one_defaults. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
66
66
|
|
67
67
|
## License
|
68
68
|
|
@@ -70,4 +70,4 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
70
70
|
|
71
71
|
## Code of Conduct
|
72
72
|
|
73
|
-
Everyone interacting in the Activerecord::HasOneDefaults project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
73
|
+
Everyone interacting in the Activerecord::HasOneDefaults project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/GoodMeasuresLLC/activerecord-has_one_defaults/blob/master/CODE_OF_CONDUCT.md).
|
@@ -21,6 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
+
spec.add_dependency "activerecord", [">= 5.1", "< 6.1"]
|
25
|
+
|
24
26
|
spec.add_development_dependency "bundler", "~> 1.15"
|
25
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
@@ -21,7 +21,7 @@ module ActiveRecord
|
|
21
21
|
# Specifies that if the association is access, but has not yet been
|
22
22
|
# initialized. Use with a boolean or a hash. If a hash is provided, those
|
23
23
|
# will be the defaults for a newly built object
|
24
|
-
def has_one(name, scope = nil, options
|
24
|
+
def has_one(name, scope = nil, **options)
|
25
25
|
default_option = scope.is_a?(Hash) ? scope.delete(:default) : options.delete(:default)
|
26
26
|
klass = self
|
27
27
|
original_has_one(name, scope, options).tap do
|
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-has_one_defaults
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Naegle
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.1'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '6.1'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '5.1'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '6.1'
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
name: bundler
|
15
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -77,7 +97,9 @@ files:
|
|
77
97
|
- ".gitignore"
|
78
98
|
- ".rspec"
|
79
99
|
- ".travis.yml"
|
100
|
+
- CHANGELOG.md
|
80
101
|
- CODE_OF_CONDUCT.md
|
102
|
+
- CONTRIBUTING.md
|
81
103
|
- Gemfile
|
82
104
|
- LICENSE
|
83
105
|
- README.md
|
@@ -85,6 +107,9 @@ files:
|
|
85
107
|
- activerecord-has_one_defaults.gemspec
|
86
108
|
- bin/console
|
87
109
|
- bin/setup
|
110
|
+
- gemfiles/rails-5.1.rb
|
111
|
+
- gemfiles/rails-5.2.rb
|
112
|
+
- gemfiles/rails-6.0.rb
|
88
113
|
- lib/activerecord/has_one_defaults.rb
|
89
114
|
- lib/activerecord/has_one_defaults/version.rb
|
90
115
|
homepage: https://github.com/GoodMeasuresLLC/activerecord-has_one_default
|
@@ -107,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
132
|
version: '0'
|
108
133
|
requirements: []
|
109
134
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.6
|
135
|
+
rubygems_version: 2.7.6
|
111
136
|
signing_key:
|
112
137
|
specification_version: 4
|
113
138
|
summary: Allows has_one associations to have a default.
|