Rails API と対話したい Chrome 拡張機能を作成しています。
Auser
にはemail
andpassword
があります。
今、私のusers_controller
見た目は次のとおりです。
def create
@user = User.new(params[:user])
if @user.save
render json: @user, status: :created, location: @user
else
render json: @user.errors, status: :unprocessable_entity
end
end
そしてChromeコンソールで、私はいくつかの作成アクションをテストしています
$.post('http://localhost:3000/users', "me@example.com");
どちらが返されますか:
{
user: {
created_at: "2013-04-27T18:11:57Z",
email: null,
id: 2,
password: null,
updated_at: "2013-04-27T18:11:57Z"
}
}
API をヒットして新しいユーザーを作成する方法について何か提案はありますか?
ありがとう!