1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
mastodon/app/models/concerns/browser_detection.rb
2024-03-19 15:39:14 +00:00

27 lines
368 B
Ruby

# frozen_string_literal: true
module BrowserDetection
extend ActiveSupport::Concern
included do
before_save :assign_user_agent
end
def detection
@detection ||= Browser.new(user_agent)
end
def browser
detection.id
end
def platform
detection.platform.id
end
private
def assign_user_agent
self.user_agent ||= ''
end
end