Skip to content

Filtering by scopes with an array as an argument raises ArgumentError #404

Description

@ohaibbq

Assuming:

class Person < ActiveRecord::Base
    scope :domestic, ->(countries) { where(country: countries) }
    def self.ransackable_scopes(auth_object=nil); [:domestic]; end
end

Trying to filter by a list of countries:

Person.search(country: ['US', 'JP'])

Will raise ArgumentError: wrong number of arguments (2 for 1)

Again, we are able to format the input in order to avoid this.

Person.search(country: [['US', 'JP']])

This avoids the issue as it seems to be a problem with splatting the args.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions