Skip to content

Instantly share code, notes, and snippets.

@patrick99e99
Created October 31, 2014 02:40
Show Gist options
  • Save patrick99e99/324254415d66878dc319 to your computer and use it in GitHub Desktop.
Save patrick99e99/324254415d66878dc319 to your computer and use it in GitHub Desktop.
class FooController < ApplicationController
respond_to :json
def show
resource = SomeModelWithErrors.new
respond_with resource, serializer: MySerializer
end
end
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