fixes #2640: Change some API representations

This commit is contained in:
r888888888
2016-08-22 10:41:34 -07:00
parent 3c42df51c9
commit f5ee618342
2 changed files with 15 additions and 1 deletions

View File

@@ -77,7 +77,21 @@ class PostFlag < ActiveRecord::Base
end
end
module ApiMethods
def hidden_attributes
super + [:creator_id]
end
def serializable_hash(options = {})
options ||= {}
options[:except] ||= []
options[:except] += hidden_attributes
super(options)
end
end
extend SearchMethods
include ApiMethods
def update_post
post.update_column(:is_flagged, true) unless post.is_flagged?