Skip to content

Provide possible types to has_scope #124

@baka-san

Description

@baka-san

I'm not sure if this is possible or if it is a feature request, but I'd like to be able to do something like has_scope :region_id, type: [:default, :array]. I don't necessarily know how the user will be passing the data so it could be an integer, e.g. ?region_id=1 or an array, e.g. ?region_id[]=1&region_id[]=2. I did try the following and it did NOT work.

has_scope :region_id, if: ->(request) { request.params[:region_id].is_a? String }
has_scope :region_id, type: :array, if: ->(request) { request.params[:region_id].is_a? Array }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions