code
oh ok, in app/models/status.rb
:
'''
before_create :set_locality
'''
and then in there
'''
def set_locality
if account.domain.nil? && !attribute_changed?(:local_only)
self.local_only = marked_local_only?
end
end
'''
and a couple paragraphs above that:
'''
def marked_local_only?
# match both with and without U+FE0F (the emoji variation selector)
/#{local_only_emoji}\ufe0f?\z/.match?(content)
end
def local_only_emoji
'👁'
end
'''
re: code
before_create is a callback on ActiveRecords---https://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html
re: code
it gets invoked when an ActiveRecord is saved
re: why is that not code blocks
@aescling backticks ` make code blocks
also maybe tildes?
not sure but if this follows commonmark spec it should
re: code
why is that not code blocks