Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #16798 - move scoped_search definitions to STI subclasses
scoped_search doesn't support class inheritance with STI, so registering definitions on the subclass fixes various issues. This fixes an issue where scoped_search on CommonParameter calls Parameter.all and is returned a list of CommonParameters under Rails 4.2, as it relies on a bug (#18806) for applying the type='CommonParameter' condition when calling Parameter.all. On Rails 5.0, this bug was fixed and calling Parameter.all within a scope on CommonParameter now returns all types of parameters. Registering all scoped_search definitions on the subclasses ensures that scoped_search calls CommonParameter.all instead. The taxonomies API changed as it called Taxonomix objects with scopes such as `.locations.search_for`, which no longer existed when the scoped_search definitions were removed from Taxonomy (.locations is a Taxonomy association with a where clause). This now explicitly searches via the appropriate Taxonomy subclass.
- Loading branch information
Showing
7 changed files
with
31 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module NestedAncestryCommon::Search | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
scoped_search :on => :title, :complete_value => true, :default_order => true | ||
scoped_search :on => :name, :complete_value => :true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters