diff options
author | Matt Jankowski <mjankowski@thoughtbot.com> | 2017-04-28 09:12:37 -0400 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-04-28 15:12:37 +0200 |
commit | 9566893cc973671f151ceabf266d260ebba57492 (patch) | |
tree | 1f575905b552ba758a08300b96c91122e3ef6dc4 /app/models | |
parent | 0e2589867f2a54fe9a71c20560d90d7f77c12bd3 (diff) |
More controller specs (#2561)
* Add render_views in more places * Delegate methods from account to user with allow nil true, so that admin accounts show view renders when missing a user * Use actual account instances in authorize follow controller spec
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index b8927c51f..19f8ca365 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -74,6 +74,14 @@ class Account < ApplicationRecord scope :alphabetic, -> { order(domain: :asc, username: :asc) } scope :by_domain_accounts, -> { group(:domain).select(:domain, 'COUNT(*) AS accounts_count').order('accounts_count desc') } + delegate :email, + :current_sign_in_ip, + :current_sign_in_at, + :confirmed?, + to: :user, + prefix: true, + allow_nil: true + def follow!(other_account) active_relationships.where(target_account: other_account).first_or_create!(target_account: other_account) end |