3
我想通过主动资源创建一个新客户。没有authentication_key它没有什么大不了的。我正在使用设计认证和cancan。主动资源的自定义参数
customer = Customer.create(:fname=>'sampath , :last_name=>'munasinghe' ,:auth_token=>'af34afafasfasfasaf')
如果我用上面的代码来创建一个新的客户,XML请求的Web服务器是
Parameters: {"customer"=>{"first_name"=>'sampath', "last_name"=>"munasinghe", "auth_token"=>"af34afafasfasfasaf"}}
问题ID的auth_token由客户模型包裹。所以,身份验证失败并返回401响应。
有没有解决方案来创建这种格式的请求?
参数:{ “客户”=> { “FIRST_NAME”=> '萨姆帕斯', “姓氏”=> “穆纳辛格”}, “AUTH_TOKEN”=> “af34afafasfasfasaf”}}
注意: auth_token位于客户区块之外。
感谢
http://stackoverflow.com/questions/2918419/add-api-key-to-every-request-in-activeresource ?? – Fivell 2011-03-31 14:30:11