active_record-acts_as 4.0.0 → 4.0.1

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
  SHA256:
3
- metadata.gz: dc594008886af5220c93ce7a44e2d7e5e2420b12d5930fc2d5387172fa0065b8
4
- data.tar.gz: 73b4f16970e323e9c266f7b7148068f99939efcfa12c323f08b23f4b3a4c63de
3
+ metadata.gz: 7bbf784064285f142f5dd1eee109a35d8e029ef901acdfaafd80abfb5f26baa7
4
+ data.tar.gz: 2deb021f21354c3c979ebbb1d0d4a321cc1ad65c0492619f8640c3d531cb2e85
5
5
  SHA512:
6
- metadata.gz: f4395d3cec20378b993702c59b88981549c1db17d14fc76231ceb936a2c85d445e22ce4898127268e3644aae4d29d580c8abe1792136fb670a1a4f4b7bc5ec3a
7
- data.tar.gz: 47188691e2f6e66dc6fbd6188594400efd2a05812d655c808c129b6055ed070f12ce16a2f88eeb425f81ca067a55664a3610a6a8ec3de838ed8576a87942ec58
6
+ metadata.gz: c9028738f881f4af60e5c7bee2e4c5a8b04d2d2030ff10a90fd165fe6577507917245faafc0dedf9bd19fe21e6e9d2c1f643e1cdbdd705cd3c91c2325d211865
7
+ data.tar.gz: 33967ee31ec525f2836bff93d972177c4a3109bd3de28aa389a43892716a8879bb5a05c1d3082d7464ddaa24f7cfd71d8b5b9e51fa48280e32650ab57a8581ee
data/Appraisals CHANGED
@@ -10,6 +10,14 @@ appraise 'rails-5.1' do
10
10
  gem 'rails', '~> 5.1.0'
11
11
  end
12
12
 
13
+ appraise 'rails-5.2.1' do
14
+ gem 'rails', '5.2.1'
15
+ end
16
+
17
+ appraise 'rails-5.2.1.1' do
18
+ gem 'rails', '5.2.1.1'
19
+ end
20
+
13
21
  appraise 'rails-5.2' do
14
22
  gem 'rails', '~> 5.2.0'
15
23
  end
data/CHANGELOG.md CHANGED
@@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [4.0.0] - 2019-01-09
8
+
9
+ ## [3.1.0] - 2018-12-13
10
+
11
+ ## [3.0.2] - 2018-08-12
12
+
13
+ ## [3.0.1] - 2018-04-25
14
+
15
+ ## [3.0.0] - 2019-02-21
16
+
17
+ ## [2.5.0] - 2017-07-29
18
+ ### Changed
19
+ - Drop support for Rails >= 5.0
20
+ - Remove warnings occurring in Rails 5.1
21
+
7
22
  ## [2.4.2] - 2017-04-20
8
23
  ### Fixed
9
24
  - Fix querying for conditions with hashes.
@@ -92,7 +107,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
92
107
  ### Fixed
93
108
  - Fixed `remove_actable` migration helper (https://github.com/hzamani/active_record-acts_as/pull/71, thanks to [nuclearpidgeon](https://github.com/nuclearpidgeon)!)
94
109
 
95
- [Unreleased]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.4.2...HEAD
110
+ [Unreleased]: https://github.com/krautcomputing/active_record-acts_as/compare/v4.0.0...HEAD
111
+ [3.1.0]: https://github.com/krautcomputing/active_record-acts_as/compare/v3.1.0...v4.0.0
112
+ [3.0.2]: https://github.com/krautcomputing/active_record-acts_as/compare/v3.0.1...v3.0.2
113
+ [3.0.1]: https://github.com/krautcomputing/active_record-acts_as/compare/v3.0.0...v3.0.1
114
+ [3.0.0]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.5.0...v3.0.0
115
+ [2.5.0]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.4.2...v2.5.0
96
116
  [2.4.2]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.4.1...v2.4.2
97
117
  [2.4.1]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.4.0...v2.4.1
98
118
  [2.4.0]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.3.1...v2.4.0
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = ">= 2.4"
22
22
 
23
- spec.add_development_dependency "sqlite3", "~> 1.3"
23
+ spec.add_development_dependency "sqlite3", "~> 1.3.6"
24
24
  spec.add_development_dependency "bundler"
25
25
  spec.add_development_dependency "rspec", "~> 3"
26
26
  spec.add_development_dependency "rake", "~> 10"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "coveralls", require: false
6
+ gem "rails", "5.2.1.1"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "coveralls", require: false
6
+ gem "rails", "5.2.1"
7
+
8
+ gemspec path: "../"
@@ -28,8 +28,17 @@ module ActiveRecord
28
28
 
29
29
  module ScopeForCreate
30
30
  def scope_for_create(attributes = nil)
31
+ unless acting_as?
32
+ if Gem::Dependency.new('', '>= 5.2.1', '< 5.2.2').match?('', ActiveRecord.version)
33
+ return super(attributes)
34
+ else
35
+ return super()
36
+ end
37
+ end
38
+
31
39
  scope = respond_to?(:values_for_create) ? values_for_create(attributes) : where_values_hash
32
- scope.merge!(where_values_hash(acting_as_model.table_name)) if acting_as?
40
+ scope.merge!(where_values_hash(acting_as_model.table_name))
41
+ scope.merge!(attributes) if attributes
33
42
  scope.merge(create_with_value)
34
43
  end
35
44
  end
@@ -1,6 +1,6 @@
1
1
  module ActiveRecord
2
2
  module ActsAs
3
- VERSION = "4.0.0"
3
+ VERSION = "4.0.1"
4
4
  end
5
5
  end
6
6
 
@@ -0,0 +1,23 @@
1
+ require 'models'
2
+
3
+ RSpec.describe 'Model Initialization' do
4
+ subject { Pen }
5
+
6
+ let(:pen_attributes) { { name: 'pen', color: 'red' } }
7
+
8
+ before(:each) { clear_database }
9
+
10
+ it 'find_or_initialize_by works' do
11
+ pen = subject.find_or_initialize_by(pen_attributes)
12
+ expect(pen.persisted?).to be false
13
+ expect(pen.name).to eq(pen_attributes[:name])
14
+ expect(pen.color).to eq(pen_attributes[:color])
15
+ end
16
+
17
+ it 'where.first_or_initialize works' do
18
+ pen = subject.where(pen_attributes).first_or_initialize
19
+ expect(pen.persisted?).to be false
20
+ expect(pen.name).to eq(pen_attributes[:name])
21
+ expect(pen.color).to eq(pen_attributes[:color])
22
+ end
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record-acts_as
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hassan Zamani
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-01-09 00:00:00.000000000 Z
12
+ date: 2019-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqlite3
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.3'
20
+ version: 1.3.6
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.3'
27
+ version: 1.3.6
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -149,6 +149,8 @@ files:
149
149
  - gemfiles/rails_4.2.gemfile
150
150
  - gemfiles/rails_5.0.gemfile
151
151
  - gemfiles/rails_5.1.gemfile
152
+ - gemfiles/rails_5.2.1.1.gemfile
153
+ - gemfiles/rails_5.2.1.gemfile
152
154
  - gemfiles/rails_5.2.gemfile
153
155
  - lib/active_record/acts_as.rb
154
156
  - lib/active_record/acts_as/class_methods.rb
@@ -162,6 +164,7 @@ files:
162
164
  - spec/active_record_spec.rb
163
165
  - spec/acts_as_spec.rb
164
166
  - spec/database_helper.rb
167
+ - spec/find_or_initialize_by_spec.rb
165
168
  - spec/migrations_spec.rb
166
169
  - spec/models.rb
167
170
  - spec/rspec_matchers_spec.rb
@@ -194,6 +197,7 @@ test_files:
194
197
  - spec/active_record_spec.rb
195
198
  - spec/acts_as_spec.rb
196
199
  - spec/database_helper.rb
200
+ - spec/find_or_initialize_by_spec.rb
197
201
  - spec/migrations_spec.rb
198
202
  - spec/models.rb
199
203
  - spec/rspec_matchers_spec.rb