eac_rails_utils 0.23.0 → 0.23.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9f7ed3ae0a13dc0aa2f380322270a36a0c35784c6bb9b13a5145dcade4ce9ab
|
4
|
+
data.tar.gz: e87c326dca2c7c0e1de5f8cdabcf35d3daab5bd907d6812b1144cd5c24a4c901
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd14c49a2cd8e303b5542d5d50913ff455c9dd8e8f463ecfad41544c35ebaae034cee96c7d1a14de81f6532613eee511c058425dc6b83fb2d3af94cbf7b21f16
|
7
|
+
data.tar.gz: 55f27beab83da5a622866bb40f911ee7374e088609040cb7df50ed32262b5e5d76ceba41b95ee97210c6a405c09105e3bb7608447478bdc5e2d096dcfcdf92b4
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'activemodel/associations'
|
4
|
-
require 'eac_rails_utils/patches/rails_4'
|
5
4
|
require 'eac_rails_utils/patches/rails_5_2'
|
6
5
|
|
7
6
|
module EacRailsUtils
|
@@ -10,18 +9,9 @@ module EacRailsUtils
|
|
10
9
|
module Hooks
|
11
10
|
class << self
|
12
11
|
def init
|
13
|
-
init_rails_4 if ::EacRailsUtils::Patches::Rails4.enabled?
|
14
12
|
init_rails_5_2 if ::EacRailsUtils::Patches::Rails52.enabled?
|
15
13
|
end
|
16
14
|
|
17
|
-
def init_rails_4 # rubocop:disable Naming/VariableNumber
|
18
|
-
ActiveSupport.on_load(:active_record) do
|
19
|
-
ActiveRecord::Associations::AssociationScope.prepend(
|
20
|
-
::EacRailsUtils::Patches::Rails4::ActiveRecordAssociationsAssociationScope
|
21
|
-
)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
15
|
def init_rails_5_2 # rubocop:disable Naming/VariableNumber
|
26
16
|
rails_5_2_fix_activemodel_associations_methods
|
27
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_rails_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.23.
|
4
|
+
version: 0.23.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- E.A.C.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootstrap-sass
|
@@ -202,8 +202,6 @@ files:
|
|
202
202
|
- lib/eac_rails_utils/patches/application.rb
|
203
203
|
- lib/eac_rails_utils/patches/numeric.rb
|
204
204
|
- lib/eac_rails_utils/patches/numeric/number_helper.rb
|
205
|
-
- lib/eac_rails_utils/patches/rails_4.rb
|
206
|
-
- lib/eac_rails_utils/patches/rails_4/active_record_associations_association_scope.rb
|
207
205
|
- lib/eac_rails_utils/patches/rails_5_2.rb
|
208
206
|
- lib/eac_rails_utils/patches/rails_5_2/active_model_association_method_fix.rb
|
209
207
|
- lib/eac_rails_utils/rspec.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'activemodel/associations'
|
4
|
-
|
5
|
-
module EacRailsUtils
|
6
|
-
module Patches
|
7
|
-
module Rails4
|
8
|
-
module ActiveRecordAssociationsAssociationScope
|
9
|
-
def add_constraints(scope, owner, association_klass, *extra_args)
|
10
|
-
if extra_args.any?
|
11
|
-
refl = extra_args.first
|
12
|
-
if refl.options[:active_model]
|
13
|
-
target_ids = refl.options[:target_ids]
|
14
|
-
return scope.where(id: owner[target_ids])
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
super
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_rails_utils/models/tableless_associations/hooks'
|
4
|
-
require 'eac_ruby_utils/require_sub'
|
5
|
-
|
6
|
-
module EacRailsUtils
|
7
|
-
module Patches
|
8
|
-
module Rails4
|
9
|
-
::EacRubyUtils.require_sub __FILE__
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def enabled?
|
13
|
-
::Rails.version < '5'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|