# app/models/post.rb
class Post < ApplicationRecord
  extend FriendlyId

  # This post model have a name column
  friendly_id :name, use: :finders
end

```

With this setup, you can use `Post.find("bar")` to find records by their custom IDs.

:::info
For a version of [friendly_id](https://github.com/norman/friendly_id) smaller then 5.0 you can use custom query scopes
:::
View [friendly_id](https://github.com/norman/friendly_id) setup in action: [View Demo](https://main.avodemo.com/avo/resources/users)

Check out the code: [Code on GitHub](https://github.com/avo-hq/main.avodemo.com/blob/main/app/models/user.rb)

## Example with Prefixed IDs

Prefixed IDs involve adding a custom prefix to your IDs.

**Install [prefixed_ids](https://github.com/excid3/prefixed_ids) gem by adding this line to your application's Gemfile:**

```ruby
gem "prefixed_ids"
```

And then execute:

```bash
bundle install
```

**Basic Usage**

Add `has_prefix_id :my_prefix` to your models to autogenerate prefixed IDs:
```ruby{3}