Created
April 25, 2014 08:14
-
-
Save samnang/11281733 to your computer and use it in GitHub Desktop.
This file contains 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
def json_for(target, options = {}) | |
options[:root] = false | |
options[:scope] ||= current_user | |
options[:url_options] ||= url_options | |
serializer = options.delete(:serializer) || target.active_model_serializer | |
serializer.new(target, options).to_json | |
end |
Author
samnang
commented
Apr 25, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment