Created
January 7, 2009 21:16
-
-
Save paul/44440 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 Exceptions < Application | |
# handle RecordInvalid exceptions (406) | |
def record_invalid | |
@errors = request.exceptions.first.errors | |
rename_error_fields! | |
if content_type == :html | |
request.controller.send(request.params[:action]) | |
else | |
render | |
end | |
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 RegisteredTemplates < Application | |
def create | |
@registered_template = configuration.registered_templates.new(params[:registered_template]) | |
if @registered_template.save | |
head(Created, :location => uri(:configuration_registered_template, | |
:configuration_id => configuration.id, | |
:id => @registered_template.id)) | |
else | |
raise RecordInvalid.new(@registered_template.errors) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment