Skip to content

Commit

Permalink
Add namespaced example (#1422)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigmcnamara committed Jul 30, 2023
1 parent 6dcc28d commit e13cf7b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/docs/going-further/polymorphic-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ Location.ransack(locatable_of_House_type_number_eq: 100).result
```

note the `_of_House_type_` added to the search key. This allows Ransack to correctly specify the table names in SQL join queries.

For namespaced models you should use a quoted string containing the standard Ruby module notation

```ruby
Location.ransack('locatable_of_Residences::House_type_number_eq' => 100).result
```

0 comments on commit e13cf7b

Please sign in to comment.