Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
simple_controller
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
simple_controller
Commits
d16c089d
Commit
d16c089d
authored
Feb 24, 2022
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 解决排序问题,遗漏了另外一个地方
parent
c9c54592
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
base_controller.rb
lib/simple_controller/base_controller.rb
+6
-2
No files found.
lib/simple_controller/base_controller.rb
View file @
d16c089d
...
...
@@ -280,11 +280,15 @@ class SimpleController::BaseController < ::InheritedResources::Base
unless
self
.
class
.
instance_variable_get
(
:@ransack_off
)
||
params
[
:sub_q
].
blank?
association
=
Array
(
params
[
:sub_q
][
:scopes
]).
reduce
(
association
)
{
|
_association
,
_scope
|
_association
.
send
(
_scope
)
}
if
params
[
:sub_q
][
:scopes
].
present?
association
=
ransack_association
(
association
,
params
[
:sub_q
].
except
(
:scopes
))
association
=
ransack_association
(
association
,
params
[
:sub_q
].
except
(
:scopes
,
:refs
))
end
unless
self
.
class
.
instance_variable_get
(
:@ransack_off
)
||
params
[
:q
].
blank?
association
=
Array
(
params
[
:q
][
:scopes
]).
reduce
(
association
)
{
|
_association
,
_scope
|
_association
.
send
(
_scope
)
}
if
params
[
:q
][
:scopes
].
present?
association
=
ransack_association
(
association
,
params
[
:q
].
except
(
:scopes
))
association
=
ransack_association
(
association
,
params
[
:q
].
except
(
:scopes
,
:refs
))
end
if
params
[
:q
][
:refs
].
present?
_refs
=
Array
(
params
[
:q
][
:refs
]).
map
(
&
:to_sym
)
association
=
association
.
includes
(
*
_refs
).
joins
(
*
_refs
)
end
association
=
association
.
distinct
unless
self
.
class
.
instance_variable_get
(
:@distinct_off
)
||
!
association
.
respond_to?
(
:distinct
)
||
!
active_record?
association
...
...
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