18 lines
540 B
Ruby
18 lines
540 B
Ruby
class Profile < ActiveRecord::Base
|
|
belongs_to :user
|
|
has_many :social_links
|
|
has_many :passive_relationships, class_name: "Relationship",
|
|
foreign_key: "followable_id",
|
|
dependent: :destroy
|
|
# has_many :followers, through: :passive_relationships, source: :follower
|
|
has_many :microposts, as: :micropostable
|
|
|
|
def followers
|
|
Relationship.where("followable_id = ? AND followable_type = ?", self.id, self.class.to_s)
|
|
end
|
|
|
|
def display_name
|
|
name
|
|
end
|
|
end
|