I'm not sure a ternary is necessary to get category_num.
```ruby
def category_num
  attributes['category_num'] || 0
end
```