Created
November 4, 2014 17:58
-
-
Save bmarcot/55e3422f241a632f8997 to your computer and use it in GitHub Desktop.
To include any methods on the model, use :methods.
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
class Content | |
def type | |
self.class.name | |
end | |
end | |
class TwitterContent | |
def type | |
"twitter" | |
end | |
end | |
def show | |
@contents = ... | |
respond_to do |format| | |
format.html | |
format.json { render :json => @contents.to_json(:methods => :type) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment