-
-
Save caius/480775 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 show | |
# By making it a bang (!) finder it raises RecordNotFound if nothing's found. | |
@movie = Movie.find_by_channel_id!(params[:id]) | |
# We found something, render it as XML | |
respond_to do |format| | |
format.xml { render :xml => @movie } | |
end | |
# Oh noes. Nothing found. Tell ze user with a 404. | |
rescue ActiveRecord::RecordNotFound | |
respond_to do |f| | |
# Check what to actually render as XML here. Don't think a string is right. | |
f.xml { render :xml => "Not Found", :status => :not_found } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment