Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ based on the input attribute name, you can pass an object with a
end
```

#### Mutlple Options Endpoints per Resource
#### Multiple Options Endpoints per Resource

A single ActiveAdmin resource can define multiple options endpoints:

Expand Down Expand Up @@ -167,6 +167,23 @@ To specify which collection to use, pass an object with a
end
```

#### Querying Multiple Attributes

ActiveAdmin Searchable Select querying is performed by Ransack. As such, you can
build your query in a way that it can query multiple attributes at once.

```ruby
ActiveAdmin.register User do
searchable_select_options(scope: User.all,
text_attribute: :username,
filter: lambda do |term, scope|
scope.ransack(email_or_username_cont: term).result
end)
end
```

In this example, the `all` scope will query `email OR username`.

#### Passing Parameters

You can pass additional parameters to the options endpoint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def collection_from_options

def ajax_url
return unless options[:ajax]
template.polymorphic_path([:admin, ajax_resource_class],
template.polymorphic_path([template.active_admin_namespace.name, ajax_resource_class],
action: option_collection.collection_action_name,
**ajax_params)
end
Expand Down