def create
build_resource(sign_up_params.select{|k,v| v.present?})
if Identity.identity_exists?(resource.email)
# Prompt user to sign in with Facebook instead
puts 'prompt user to sign in with facebook'
else
if resource.save
# redirect_to_signup_finish / return ?
else
clean_up_passwords resource
end
end
respond_to do |format|
format.html { render :new }
format.json { render :json => { errors: resource.errors }, :status => :unprocessable_entity }
end
end
我有这个代码,如果用户使用与以前相同的电子邮件注册Facebook,我们会阻止用户再次注册。相反,我们提示他们登录facebook。我们想要创建一个自定义resource.errors
来说明这种情况。实现它的最佳方法是什么?