Created
October 31, 2014 02:40
-
-
Save patrick99e99/324254415d66878dc319 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
class FooController < ApplicationController | |
respond_to :json | |
def show | |
resource = SomeModelWithErrors.new | |
respond_with resource, serializer: MySerializer | |
end | |
end | |
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 SomeModelWithErrors | |
include ActiveModel::Validations | |
def initialize | |
@errors = ActiveModel::Errors.new(self) | |
errors.add(:base, 'lol') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment