Question: I would like to create a default **Category** for each **User**'s **Company**, after he creates one. 

Elaborating,

```
User
  has_many :companies

Company
  belongs_to :user
  has_many :categories

```

After a user creates a new company, I would like it to have a default category.

So something like

**Company.rb**

```
after_create :create_default_category

private

  def create_default_category
    self.category.new(name: "default")
  end

```

The code above, not surprisingly, is dysfunctional. Would appreciate your help!

Answer: 
The issue is because you want to create category but you have a has\_many relationship - so if you wont after\_create then you have to use categories.create so:

```
self.categories.create(name: "default")

```
```
def create_default_category
    category = self.category.new(name: "default")
    category.save
end

```