It looks like you’re not checking whether the model is actually saving correctly. In the code above, pet.save will return false but you’re not checking the returned value. You need to either use:
if pet.save
File.open(filename, "wb") { |f| f.write(@file.read) }
redirect_to(:controller=>'user', :action=>'petadmin')
else
# Fallback action
end
or use pet.save! which will raise an exception if the model is invalid.
You might also want to look at using before_filter rather than calling check_authentication in every method.
James.