0
0
Fork 0

Define instance method outside #included (#3128)

This commit is contained in:
alpaca-tc 2017-05-19 18:41:45 +09:00 committed by Eugen Rochko
parent 6e4c7d6211
commit 198ae3e366
5 changed files with 103 additions and 105 deletions

View file

@ -6,36 +6,38 @@ module Streamable
included do
has_one :stream_entry, as: :activity
def title
super
end
def content
title
end
def target
super
end
def object_type
:activity
end
def thread
super
end
def hidden?
false
end
def needs_stream_entry?
account.local?
end
after_create do
account.stream_entries.create!(activity: self, hidden: hidden?) if needs_stream_entry?
end
end
def title
super
end
def content
title
end
def target
super
end
def object_type
:activity
end
def thread
super
end
def hidden?
false
end
private
def needs_stream_entry?
account.local?
end
end