You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a huge caveat when using the _simple_filters scope query parameter. If the scope we wish to update with _simple_filters does not exist yet (with an empty session, for example) the filters will be placed in the default scope (default_scope_name). This is very rarely what is desired since this default is rarely used.
For example, a simple filtering URL like /userfiles?_simple_filters=1&data_provider_id=1 will create a userfiles#index scope instead of the expected userfiles one (if there is no userfiles scope yet) and the specified filters wont be applied, as the controller expects its scope to be userfiles, not userfiles#index.
if(simple=params['_simple_filters'])# Determine which scope to updateknown=(current_session['scopes'] ||= {})controller=params[:controller].to_s.downcasename=simpleifknown.has_key?(simple)name ||= controllerifknown.has_key?(controller)name ||= default_scope_name# ...
Unfortunately, there is no way to know at that point in update_session_scopes where to place the given filters if the session does not contain either the parameter (simple) or the controller name (controller). This issue notably only concerns the first request made; on subsequent requests, the controller will have set up its scope and name ||= controller if known.has_key?(controller) will correctly assign the desired scope name.
Trickier _simple_filters handling to cleanly (somewhat) allow new scopes
to be created when the session is empty. The new behavior is for a scope
to be created with _simple_filters's value when none can be found
(including other defaults), falling back to default_scope_name if
_simple_filters's value looks like '1' or 'true'.
While hard to precisely define, this behavior should hopefully be
simpler to use and fix the current issue.
There is a huge caveat when using the
_simple_filters
scope query parameter. If the scope we wish to update with_simple_filters
does not exist yet (with an empty session, for example) the filters will be placed in the default scope (default_scope_name
). This is very rarely what is desired since this default is rarely used.For example, a simple filtering URL like
/userfiles?_simple_filters=1&data_provider_id=1
will create auserfiles#index
scope instead of the expecteduserfiles
one (if there is nouserfiles
scope yet) and the specified filters wont be applied, as the controller expects its scope to beuserfiles
, notuserfiles#index
.view_scopes.rb:1235:
Unfortunately, there is no way to know at that point in
update_session_scopes
where to place the given filters if the session does not contain either the parameter (simple
) or the controller name (controller
). This issue notably only concerns the first request made; on subsequent requests, the controller will have set up its scope andname ||= controller if known.has_key?(controller)
will correctly assign the desired scope name.Underlying cause of aces/cbrain-apis#5
The text was updated successfully, but these errors were encountered: