Last active
November 25, 2015 13:32
-
-
Save dobryakov/aa2b53f8e5064054f358 to your computer and use it in GitHub Desktop.
@items.to_json(:user => current_user)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attr_accessor :current_user | |
def serializable_hash(options={}) | |
options = {} if options.nil? | |
self.current_user = options[:user] | |
options[:methods] ||= [ :participated_friends_ids ] | |
super(options) | |
end | |
def participated_friends_ids(user = self.current_user) | |
unless user.nil? | |
# do some work | |
else | |
[] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Magic for personal serializing to json for each user separately.