action_scope 0.1.1 → 0.1.2
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 +4 -4
- data/lib/action_scope/associations.rb +6 -2
- data/lib/action_scope/version.rb +1 -1
- metadata +1 -2
- data/lib/action_scope/scopable.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a7009b298ef571fbbf4cc29660f6abdd701a16d3695dc011829eec14fcbf5ad
|
4
|
+
data.tar.gz: 346321e5d9d72e73b309dda5954aaa66d4ed546c0b92e96ff306e1bf04dccd84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd0c82e231e2b8789a05b0b91f5c6e32195cd5e8dd9daff1ec4cb1bfabfe9bcaacce3ce5e4539031a5bb12f7293fd9ef99c256922418f94f4d67eba7dd64a878
|
7
|
+
data.tar.gz: a6d7144b8f1a7f0cc76e99c97bb5735481342f22fe77226f7b8d959c31eed9ab74b604ae95f8e6e92c6159ff14b67b1bab99e826a5c98a94e4bf4536dc748212
|
@@ -47,8 +47,12 @@ module ActionScope::Associations
|
|
47
47
|
|
48
48
|
def association_scopes_with_primary_keys
|
49
49
|
associations_for_scopes.each_with_object({}) do |association, h|
|
50
|
-
|
51
|
-
|
50
|
+
begin
|
51
|
+
if defined_scopes.include?(:"by_#{association.name.to_s.singularize}")
|
52
|
+
h[:"by_#{association.name.to_s.singularize}"] = association.association_primary_key
|
53
|
+
end
|
54
|
+
rescue ActiveRecord::UnknownPrimaryKey # may not exist if no primary key in join table
|
55
|
+
next
|
52
56
|
end
|
53
57
|
end
|
54
58
|
end
|
data/lib/action_scope/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_scope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OrestF
|
@@ -101,7 +101,6 @@ files:
|
|
101
101
|
- lib/action_scope/matchable.rb
|
102
102
|
- lib/action_scope/multi_searchable.rb
|
103
103
|
- lib/action_scope/rangeable.rb
|
104
|
-
- lib/action_scope/scopable.rb
|
105
104
|
- lib/action_scope/sortable.rb
|
106
105
|
- lib/action_scope/version.rb
|
107
106
|
- sig/action_scope.rbs
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ActionScope::Scopable
|
4
|
-
# extend ActiveSupport::Concern
|
5
|
-
#
|
6
|
-
# include ActionScope::Associations
|
7
|
-
# include ActionScope::Basic
|
8
|
-
# include ActionScope::Matchable
|
9
|
-
# include ActionScope::MultiSearchable
|
10
|
-
# include ActionScope::Rangeable
|
11
|
-
# include ActionScope::Sortable
|
12
|
-
#
|
13
|
-
# class_methods do
|
14
|
-
# def db_ready?
|
15
|
-
# need_migration =
|
16
|
-
# if Rails.version.to_f >= 7.2
|
17
|
-
# ActiveRecord::Tasks::DatabaseTasks.migration_connection_pool.migration_context.needs_migration?
|
18
|
-
# else
|
19
|
-
# ActiveRecord::Base.connection.migration_context.needs_migration?
|
20
|
-
# end
|
21
|
-
# ActiveRecord::Base.connection && ActiveRecord::Base.connected? && !need_migration
|
22
|
-
# end
|
23
|
-
#
|
24
|
-
# def define_action_scope_scopes(*col_names, except: [])
|
25
|
-
# return unless db_ready?
|
26
|
-
#
|
27
|
-
# yield(self) if block_given?
|
28
|
-
#
|
29
|
-
# define_association_scopes(*col_names, except: except)
|
30
|
-
# define_basic_scopes(*col_names, except: except)
|
31
|
-
# define_matchable_scopes(*col_names, except: except)
|
32
|
-
# define_multi_searchable_scopes(*col_names, except: except)
|
33
|
-
# define_rangeable_scopes(*col_names, except: except)
|
34
|
-
# define_sortable_scopes(*col_names, except: except)
|
35
|
-
# end
|
36
|
-
#
|
37
|
-
# def options_for_search
|
38
|
-
# %i[
|
39
|
-
# association_scopes_with_primary_keys
|
40
|
-
# basic_scopes_with_types
|
41
|
-
# matchable_scopes_with_types
|
42
|
-
# multi_searchable_scopes_with_column_names
|
43
|
-
# rangeable_scopes_scopes_with_types
|
44
|
-
# sortable_scopes_with_directions
|
45
|
-
# ].each_with_object({}) do |scope, options|
|
46
|
-
# options.merge!(send(scope)) if defined?(scope)
|
47
|
-
# end
|
48
|
-
# end
|
49
|
-
# end
|
50
|
-
end
|