アクティブリソースを通じて新しい顧客を作りたいです。authentication_key がなければ大したことではありません。私はdevise認証とcancanを使用しています。
customer = Customer.create(:fname=>'sampath , :last_name=>'munasinghe' ,:auth_token=>'af34afafasfasfasaf')
上記のコードを使用して新しい顧客を作成すると、Web サーバーへの xml 要求は
Parameters: {"customer"=>{"first_name"=>'sampath', "last_name"=>"munasinghe", "auth_token"=>"af34afafasfasfasaf"}}
顧客モデルによってラップされた問題 ID auth_token。そのため、認証に失敗し、401 応答が返されました。
この形式のリクエストを作成するソリューションはありますか?
パラメータ: {"customer"=>{"first_name"=>'sampath', "last_name"=>"munasinghe"}, "auth_token"=>"af34afafasfasfasaf"}}
注: auth_token は顧客ブロックの外にあります。
ありがとう