Question: In Rails, How can I format output of model ID(auto increment primary key) from "12" to something like this "INV000012"

Thank you in advance.

Answer: 
To format your id, use [`format`](https://ruby-doc.org/core-2.2.0/Kernel.html#method-i-format) !

```
def long_id
  format("INV%06d", id)
end

```
Create an instance method in your model:

```
def custom_id
  "INV" + id.to_s.rjust(6, '0')
end

```