```ruby
class Notebook < ActiveRecord::Base
  belongs_to :user

  validates :name, presence: true
  validates :name, uniqueness: { scope: :user_id }
end
```

Use association as a uniqueness scope not the actual column name
user
```ruby
class Notebook < ActiveRecord::Base
  belongs_to :user

  validates :name, presence: true
  validates :name, uniqueness: { scope: :user }
end
```
assistant