Module: SocialStream::Models::Actor::ClassMethods

Defined in:
lib/social_stream/models/actor.rb

Instance Method Summary collapse

Instance Method Details



67
68
69
# File 'lib/social_stream/models/actor.rb', line 67

def find_by_permalink(perm)
  joins(:actor).where('actors.permalink' => perm).first
end

#find_by_permalink!(perm) ⇒ Object



71
72
73
74
# File 'lib/social_stream/models/actor.rb', line 71

def find_by_permalink!(perm)
  find_by_permalink(perm) ||
    raise(ActiveRecord::RecordNotFound)
end

#receiving_subject_classesObject

Actor subtypes that may receive a tie from an instance of this class



60
61
62
63
64
65
# File 'lib/social_stream/models/actor.rb', line 60

def receiving_subject_classes
  Relation.select("DISTINCT #{ Relation.quoted_table_name }.receiver_type").
    where(:sender_type => to_s).
    map(&:receiver_type).
    map(&:constantize)
end

#relations(to = to_s) ⇒ Object

Relations defined for this actor model.



55
56
57
# File 'lib/social_stream/models/actor.rb', line 55

def relations(to = to_s)
  Relation.mode(to_s, to)
end