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
cba6fd2d
Commit
cba6fd2d
authored
Jan 26, 2015
by
Pablo Cantero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make mstart case insensitive
parent
d968efe9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
mongo_adapter.rb
lib/ransack_mongo/mongo_adapter.rb
+1
-1
mongo_adapter_spec.rb
spec/ransack_mongo/mongo_adapter_spec.rb
+3
-3
No files found.
lib/ransack_mongo/mongo_adapter.rb
View file @
cba6fd2d
...
...
@@ -33,7 +33,7 @@ module RansackMongo
def
mstart_matcher
(
attr
,
value
)
values
=
value
.
split
(
","
).
map
do
|
current
|
if
(
current
=
current
.
strip
).
length
>
0
/^
#{
current
}
/
/^
#{
current
}
/
i
end
end
.
compact
...
...
spec/ransack_mongo/mongo_adapter_spec.rb
View file @
cba6fd2d
...
...
@@ -46,19 +46,19 @@ module RansackMongo
it
'returns the matcher'
do
subject
.
mstart_matcher
(
'name'
,
'Pablo, Bruno,Dude'
)
expect
(
subject
.
to_query
).
to
eq
(
"name"
=>
{
"$in"
=>
[
/^Pablo/
,
/^Bruno/
,
/^Dude/
]
})
expect
(
subject
.
to_query
).
to
eq
(
"name"
=>
{
"$in"
=>
[
/^Pablo/
i
,
/^Bruno/i
,
/^Dude/i
]
})
end
it
'cleans up the input'
do
subject
.
mstart_matcher
(
'name'
,
',, , ,Pablo,,,, ,, , , ,'
)
expect
(
subject
.
to_query
).
to
eq
(
"name"
=>
{
"$in"
=>
[
/^Pablo/
]
})
expect
(
subject
.
to_query
).
to
eq
(
"name"
=>
{
"$in"
=>
[
/^Pablo/
i
]
})
end
it
'accepts single values'
do
subject
.
mstart_matcher
(
'name'
,
'Pablo'
)
expect
(
subject
.
to_query
).
to
eq
(
"name"
=>
{
"$in"
=>
[
/^Pablo/
]
})
expect
(
subject
.
to_query
).
to
eq
(
"name"
=>
{
"$in"
=>
[
/^Pablo/
i
]
})
end
end
...
...
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