active_record-acts_as 2.4.0 → 2.4.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
  SHA1:
3
- metadata.gz: 589ce7c704e9fbea72a54a837e5a6937a617abc7
4
- data.tar.gz: ffd0002ce231c728cf4508c008c4b033c12ebdf9
3
+ metadata.gz: b0bbaf8a07eceb6c10fd9e9fea3ece8a641aef69
4
+ data.tar.gz: c5c9b6265ca7464402b6cf8955c28345deee417d
5
5
  SHA512:
6
- metadata.gz: a4ddd42dca8305b4b6e10d6045455b54192834004e0289cb1a1073ed99f409342f075467b8c4a63dc812ace6e31b3cd09692ad3a4538cc08af683409833eeeff
7
- data.tar.gz: 46701f3ca1f4f00783ef1e2a58763752e5a7ff5d67f20e33ea2ac78a20f170c92ec83750d62f57687e7c1dc6336739fb6083b64deb0e350ecddc88d25380b7ef
6
+ metadata.gz: 195e8c8b7c28634bb882fdcd693341a2eb8bdad0092c1a43fda14414a55da85dda79b2b04ad5d8bd651e622a7380bc5731a082f9d996aa156968bba316639e64
7
+ data.tar.gz: 5daea8a73f30a50e7471bbf521a00dbb9313576ec508ba518f24508c1a5262a28dfcae98acb6c389e05da2ed540dce7d5b091452f25444a8b687efae75c895e7
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ 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
+ ## [2.4.1] - 2017-04-19
8
+ ### Fixed
9
+ - Make ActiveRecord::Relation#where! work.
10
+
7
11
  ## [2.4.0] - 2017-04-16
8
12
  ### Changed
9
13
  - Don't make all supermodel class methods callable by submodel, only scopes. Add `callable_by_submodel` to supermodel so users can make their own class methods callable by submodels.
@@ -84,7 +88,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
84
88
  ### Fixed
85
89
  - Fixed `remove_actable` migration helper (https://github.com/hzamani/active_record-acts_as/pull/71, thanks to [nuclearpidgeon](https://github.com/nuclearpidgeon)!)
86
90
 
87
- [Unreleased]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.4.0...HEAD
91
+ [Unreleased]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.4.1...HEAD
92
+ [2.4.1]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.4.0...v2.4.1
88
93
  [2.4.0]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.3.1...v2.4.0
89
94
  [2.3.1]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.3.0...v2.3.1
90
95
  [2.3.0]: https://github.com/krautcomputing/active_record-acts_as/compare/v2.2.1...v2.3.0
@@ -1,7 +1,7 @@
1
1
  module ActiveRecord
2
2
  module ActsAs
3
3
  module QueryMethods
4
- def where(opts = :chain, *rest)
4
+ def where!(opts, *)
5
5
  if acting_as? && opts.is_a?(Hash)
6
6
  if table_name_opts = opts.delete(klass.table_name)
7
7
  opts = opts.merge(table_name_opts)
@@ -1,6 +1,6 @@
1
1
  module ActiveRecord
2
2
  module ActsAs
3
- VERSION = "2.4.0"
3
+ VERSION = "2.4.1"
4
4
  end
5
5
  end
6
6
 
data/spec/acts_as_spec.rb CHANGED
@@ -443,22 +443,30 @@ RSpec.describe "ActiveRecord::Base model with #acts_as called" do
443
443
  before(:each) { clear_database }
444
444
 
445
445
  it "respects supermodel attributes in .where" do
446
- red_pen = Pen.create(name: 'red pen', price: 0.8, color: 'red')
447
- blue_pen = Pen.create(name: 'blue pen', price: 0.8, color: 'blue')
446
+ red_pen = Pen.create(name: 'red pen', price: 0.8, color: 'red')
447
+ blue_pen = Pen.create(name: 'blue pen', price: 0.8, color: 'blue')
448
448
  black_pen = Pen.create(name: 'black pen', price: 0.9, color: 'black')
449
449
 
450
- expect{Pen.where(price: 0.8)}.to_not raise_error
451
- expect(Pen.where(price: 0.8)).to include(red_pen, blue_pen)
452
- expect(Pen.where(price: 0.8)).to_not include(black_pen)
450
+ expect(Pen.where(price: 0.8).to_a).to eq([red_pen, blue_pen])
451
+ end
452
+
453
+ it "respects supermodel attributes in .where!" do
454
+ red_pen = Pen.create(name: 'red pen', price: 0.8, color: 'red')
455
+ blue_pen = Pen.create(name: 'blue pen', price: 0.8, color: 'blue')
456
+ black_pen = Pen.create(name: 'black pen', price: 0.9, color: 'black')
457
+
458
+ relation = Pen.all
459
+ relation.where!(price: 0.8)
460
+ expect(relation.to_a).to eq([red_pen, blue_pen])
453
461
  end
454
462
 
455
463
  it "respects supermodel attributes in .find_by" do
456
- red_pen = Pen.create(name: 'red pen', price: 0.8, color: 'red')
457
- blue_pen = Pen.create(name: 'blue pen', price: 0.8, color: 'blue')
464
+ red_pen = Pen.create(name: 'red pen', price: 0.8, color: 'red')
465
+ blue_pen = Pen.create(name: 'blue pen', price: 0.8, color: 'blue')
458
466
  black_pen = Pen.create(name: 'black pen', price: 0.9, color: 'black')
459
467
 
460
- expect(Pen.find_by(name: 'red pen')).to eq(red_pen)
461
- expect(Pen.find_by(name: 'blue pen')).to eq(blue_pen)
468
+ expect(Pen.find_by(name: 'red pen')).to eq(red_pen)
469
+ expect(Pen.find_by(name: 'blue pen')).to eq(blue_pen)
462
470
  expect(Pen.find_by(name: 'black pen')).to eq(black_pen)
463
471
  end
464
472
 
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: 2.4.0
4
+ version: 2.4.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: 2017-04-16 00:00:00.000000000 Z
12
+ date: 2017-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqlite3