diff options
author | alpaca-tc <alpaca-tc@alpaca.tc> | 2017-04-17 22:54:33 +0900 |
---|---|---|
committer | Eugen <eugen@zeonfederated.com> | 2017-04-17 15:54:33 +0200 |
commit | 630de52fdd93e7465d0fb9dac5f35db30a2545d2 (patch) | |
tree | 416935f23d0e73bd3f4fb032d7da88407bc3fa04 /app/models/mute.rb | |
parent | f8546ad5a21c840107d263acea0c051081af9c7b (diff) |
Required foreign keys (#2003)
* Add `required: true` option to foreign column * Fixes NoMethodError ``` > Favourite.new.valid? NoMethodError: undefined method `reblog?' for nil:NilClass ```
Diffstat (limited to 'app/models/mute.rb')
-rw-r--r-- | app/models/mute.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/models/mute.rb b/app/models/mute.rb index a5b334c85..7987ed007 100644 --- a/app/models/mute.rb +++ b/app/models/mute.rb @@ -3,9 +3,8 @@ class Mute < ApplicationRecord include Paginable - belongs_to :account - belongs_to :target_account, class_name: 'Account' + belongs_to :account, required: true + belongs_to :target_account, class_name: 'Account', required: true - validates :account, :target_account, presence: true validates :account_id, uniqueness: { scope: :target_account_id } end |