mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-22 19:52:18 -05:00
20 lines
395 B
Ruby
20 lines
395 B
Ruby
class Link < ApplicationRecord
|
|
belongs_to :linkable, polymorphic: true
|
|
|
|
def host
|
|
URI.parse(url).host
|
|
end
|
|
|
|
def site
|
|
PublicSuffix.parse(host).sld.to_sym
|
|
end
|
|
|
|
def self.ransackable_attributes(_auth_object = nil)
|
|
["created_at", "id", "linkable_id", "linkable_type", "updated_at", "url"]
|
|
end
|
|
|
|
def self.ransackable_associations(auth_object = nil)
|
|
["linkable"]
|
|
end
|
|
end
|