rails_or 1.1.7 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +6 -1
- data/gemfiles/5.1.gemfile +13 -0
- data/lib/rails_or.rb +16 -0
- data/lib/rails_or/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcae3f6e02afc8e2b8f4d8924a0ee5f27d1faa47
|
4
|
+
data.tar.gz: c12eab9c2692aec32299f88a2bd1ea55fd100144
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e3aba494f94ac1445b54d00fe65770bd7864614d2a1c707e517e8bb64306d2f2bfe19aae3f3be29766e39c8c70c968b97202bfc486bfdf1632d6dce0663b62f
|
7
|
+
data.tar.gz: 719bc7b6cfcddb536f086f49d534ba3a5fbcefdde9f309743255477c946e6e91ea25f5f5982248525dee7ea4e7cbf21e8e299a1c86eda86cd246ef5b1a5a349e
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
|
4
4
|
- No changes.
|
5
5
|
|
6
|
+
### RailsOr [1.1.8] - (March 14, 2018)
|
7
|
+
|
8
|
+
- Fix missing from_clause when using #from and #none together [[#23](https://github.com/khiav223577/rails_or/pull/23)] @khiav223577
|
9
|
+
|
6
10
|
### RailsOr [1.1.7] - (September 12, 2017)
|
7
11
|
|
8
12
|
- Better Rails 5 Support. [[#21](https://github.com/khiav223577/rails_or/pull/21)] @khiav223577
|
@@ -59,7 +63,8 @@
|
|
59
63
|
- Add #or method [[#1](https://github.com/khiav223577/rails_or/pull/1)] @khiav223577
|
60
64
|
<br><br>
|
61
65
|
|
62
|
-
[Unreleased]: https://github.com/khiav223577/rails_or/compare/v1.1.
|
66
|
+
[Unreleased]: https://github.com/khiav223577/rails_or/compare/v1.1.8...HEAD
|
67
|
+
[1.1.8]: https://github.com/khiav223577/rails_or/compare/v1.1.7...v1.1.8
|
63
68
|
[1.1.7]: https://github.com/khiav223577/rails_or/compare/v1.1.6...v1.1.7
|
64
69
|
[1.1.6]: https://github.com/khiav223577/rails_or/compare/v1.1.5...v1.1.6
|
65
70
|
[1.1.5]: https://github.com/khiav223577/rails_or/compare/v1.1.4...v1.1.5
|
data/lib/rails_or.rb
CHANGED
@@ -2,9 +2,24 @@ require "rails_or/version"
|
|
2
2
|
require "rails_or/where_binding_mixs"
|
3
3
|
require 'active_record'
|
4
4
|
|
5
|
+
if defined?(ActiveRecord::NullRelation)
|
6
|
+
module ActiveRecord::NullRelation
|
7
|
+
if method_defined?(:or)
|
8
|
+
if not method_defined?(:rails5_or)
|
9
|
+
alias_method :rails5_or, :or
|
10
|
+
def or(*other)
|
11
|
+
rails5_or(rails_or_parse_parameter(*other))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
5
18
|
class ActiveRecord::Relation
|
6
19
|
IS_RAILS3_FLAG = Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('4.0.0')
|
7
20
|
IS_RAILS5_FLAG = Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.0.0')
|
21
|
+
FROM_VALUE_METHOD = %i[from_value from_clause].find{|s| method_defined?(s) }
|
22
|
+
ASSIGN_FROM_VALUE = :"#{FROM_VALUE_METHOD}="
|
8
23
|
if method_defined?(:or)
|
9
24
|
if not method_defined?(:rails5_or)
|
10
25
|
alias_method :rails5_or, :or
|
@@ -84,6 +99,7 @@ class ActiveRecord::Relation
|
|
84
99
|
|
85
100
|
def rails_or_spwan_relation(method, condition)
|
86
101
|
relation = klass.send(method, condition)
|
102
|
+
relation.send(ASSIGN_FROM_VALUE, send(FROM_VALUE_METHOD))
|
87
103
|
rails_or_copy_values_to(relation) if IS_RAILS5_FLAG
|
88
104
|
return relation
|
89
105
|
end
|
data/lib/rails_or/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_or
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- khiav reoy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- gemfiles/3.2.gemfile
|
100
100
|
- gemfiles/4.2.gemfile
|
101
101
|
- gemfiles/5.0.gemfile
|
102
|
+
- gemfiles/5.1.gemfile
|
102
103
|
- lib/rails_or.rb
|
103
104
|
- lib/rails_or/version.rb
|
104
105
|
- lib/rails_or/where_binding_mixs.rb
|