Created
October 7, 2011 17:27
-
-
Save lperichon/1270858 to your computer and use it in GitHub Desktop.
nested paremeters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@contact = Contact.new(params[:contact]) | |
if @contact.save | |
render :json => { :id => @contact.id }.to_json, :status => :created | |
else | |
render :json => { :message => "Sorry, contact not created", | |
:error_codes => [], | |
:errors => @contact.errors }.to_json, :status => 400 | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started POST "/v0/contacts" for 127.0.0.1 at 2011-10-07 14:24:11 -0300 | |
Processing by V0::ContactsController#create as */* | |
Parameters: {"contact"=>{"contact_attributes"=>["{\"type\"=>\"Telephone\", \"category\"=>\"home\", \"value\"=>\"12345\", \"public\"=>1}"], "first_name"=>"lala"}} | |
WARNING: Can't verify CSRF token authenticity | |
Completed 500 Internal Server Error in 15ms | |
NoMethodError (undefined method `metadata' for #<String:0xa577f4c>): | |
app/controllers/v0/contacts_controller.rb:52:in `new' | |
app/controllers/v0/contacts_controller.rb:52:in `create' | |
Rendered /home/luis/.rvm/gems/ruby-1.9.2-p290@crm-hub/gems/actionpack-3.1.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.3ms) | |
Rendered /home/luis/.rvm/gems/ruby-1.9.2-p290@crm-hub/gems/actionpack-3.1.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.7ms) | |
Rendered /home/luis/.rvm/gems/ruby-1.9.2-p290@crm-hub/gems/actionpack-3.1.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (3.5ms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Typhoeus::Request.post( "http://localhost:3002/v0/contacts", :params => { "contact" => { "first_name" => "lala", "contact_attributes" => [{"type" => "Telephone", "category" => "home", "value" => "12345", "public" => 1}]}}, :timeout => 200 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment