Commit f2d1e645 authored by Eugen Rochko's avatar Eugen Rochko

Display and use latest connection

parent 5ee81951
class Authorization < ApplicationRecord class Authorization < ApplicationRecord
belongs_to :user, inverse_of: :authorizations belongs_to :user, inverse_of: :authorizations
default_scope { order('id asc') }
end end
...@@ -4,11 +4,11 @@ class User < ApplicationRecord ...@@ -4,11 +4,11 @@ class User < ApplicationRecord
has_many :authorizations has_many :authorizations
def twitter def twitter
@twitter ||= authorizations.find_by(provider: :twitter) @twitter ||= authorizations.where(provider: :twitter).last
end end
def mastodon def mastodon
@mastodon ||= authorizations.find_by(provider: :mastodon) @mastodon ||= authorizations.where(provider: :mastodon).last
end end
class << self class << self
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment