Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
ta_ransack_mongo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
ta_ransack_mongo
Commits
1993313e
Commit
1993313e
authored
Feb 13, 2022
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 支持cont_any的设置
parent
1700a25f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
mongo_adapter.rb
lib/ransack_mongo/mongo_adapter.rb
+6
-1
predicate.rb
lib/ransack_mongo/predicate.rb
+0
-1
No files found.
lib/ransack_mongo/mongo_adapter.rb
View file @
1993313e
module
RansackMongo
class
MongoAdapter
PREDICATES
=
%w[null not_null eq not_eq cont in start mstart gt lt gteq lteq]
PREDICATES
=
%w[null not_null eq not_eq cont
cont_any
in start mstart gt lt gteq lteq]
def
initialize
@query
=
{}
...
...
@@ -26,6 +26,11 @@ module RansackMongo
@query
[
attr
]
=
{
'$ne'
=>
value
}
end
def
cont_any_matcher
(
attr
,
value_arr
)
value
=
Array
(
value_arr
).
join
(
'|'
)
cont_matcher
(
attr
,
value
)
end
def
cont_matcher
(
attr
,
value
)
@query
[
attr
]
=
/
#{
value
}
/i
end
...
...
lib/ransack_mongo/predicate.rb
View file @
1993313e
...
...
@@ -5,7 +5,6 @@ module RansackMongo
end
def
parse
(
params
)
binding
.
pry
(
params
||
{}).
keys
.
inject
({})
do
|
query
,
query_param
|
attr
=
query_param
.
to_s
p
,
attr
=
detect_and_strip_from_string
(
attr
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment