-
-
Notifications
You must be signed in to change notification settings - Fork 827
Closed
Description
It appears that the recent additions of adding scopes (which is great!) doesn't support the API of passing unmodified ActionController::Parameters.
Assuming:
class Person < ActiveRecord::Base
scope :domestic, -> { where(country: 'US') }
def self.ransackable_scopes(auth_object=nil); [:domestic]; end
endHere's a few examples:
Person.search(domestic: true) # scopes just perfectlyForm helper using a hidden input
<%= f.hidden_field :domestic %>If the input value is set to true, it is deserialized from the request as "true".
Calling Person.search(params[:q]) will raise ArgumentError: wrong number of arguments (1 for 0) as Ransack tries to pass "true" to the scope.
If the hidden value is set to "", Ransack skips applying the scope.
For now, we are able to manually deserialize these parameters in to the correct values, but just wanted to give you a heads up.
I should be able to look in to ransack's code some more this weekend.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels