Ruby on rails 用户注册使用 rest API 调用和设计 [英] Ruby on rails User registration using rest API call and Devise
本文介绍了Ruby on rails 用户注册使用 rest API 调用和设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能指导我如何在 ruby on rails 中从移动设备(rest API)注册用户.我正在使用带有 Rails 3.0 的设计.
Can anyone guide me how to register a user from mobile device (rest API) in ruby on rails. I'm using Devise with Rails 3.0.
它给了我以下错误
设计中的名称错误::CustomRegistrationsController#create
NameError in Devise::CustomRegistrationsController#create
推荐答案
我已经使用以下内容覆盖了设计注册控制器的功能.
I've override the functionality of devise registration controller with the following.
def create
respond_to do |format|
format.html {
super
}
format.json {
build_resource
if resource.save
render :status => 200, :json => resource
else
render :json => resource.errors, :status => :unprocessable_entity
end
}
end
end
这解决了问题,我添加了
this solved the problem and I've added
skip_before_filter :verify_authenticity_token, :only => :create
避免真实性检查.
这篇关于Ruby on rails 用户注册使用 rest API 调用和设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文