Custom parameter for activeresource

I want to create a new client through activeresource. without authentication_key this is not a big problem. I use authentication and cancan.

customer = Customer.create(:fname=>'sampath , :last_name=>'munasinghe' ,:auth_token=>'af34afafasfasfasaf')

if I use the above code to create a new client, xml request to web server

Parameters: {"customer"=>{"first_name"=>'sampath', "last_name"=>"munasinghe", "auth_token"=>"af34afafasfasfasaf"}}

id id auth_token wrapped by client model. therefore, authentication failed and returned a 401 response.

is there any solution to create this request format?

Parameters: {"customer" => {"first_name" => 'sampath', "last_name" => "munasinghe"}, "auth_token" => "af34afafasfasfasaf"}}

note: auth_token is outside the client block.

thank

+3
source share
1

json - Customer.include_root_in_json false.

:

customer = Customer.create(:customer => [:fname=>'sampath' , :last_name=>'munasinghe'],:auth_token=>'af34afafasfasfasaf')
+2

All Articles