In my Rails application there is a relationship defined between Products and Categories. Each product can have different categories.

I am displaying the product's category this way:

```
<p>
    <strong>Categories:</strong>
    <%= @product.categories.join(", ") unless @product.categories.nil? %>
</p>

```

And my `Category` model:

```
class Category < ActiveRecord::Base
    def to_s
        @name
    end
end

```

However, in the show page, the categories are displayed like this:

```
Categories: #<Category:0x007f2bf515b148>, #<Category:0x007f2bf515aef0>, #<Category:0x007f2bf515ac98>

```

Why is the `to_s` method not working? How can I solve this?