I’ve created simple ROR app on Heroku’s server and I want to add product using RUBY’s script:
require ‘rubygems’
require ‘rest_client’RestClient.post ‘http://falling-ice-5948.herokuapp.com/products/new‘,
:title => ‘TESTTESTTEST’, :description => “MYTESTTESTTESTTEST”,
:image_url => “TESTTESTNULL.jpg”, :price => 4.50
There’s my page:
When I run my script it gives me an error:
ruby postEasy.rb
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in
return!': 404 Resource Not Found (RestClient::ResourceNotFound) fromprocess_result’ from
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in
transmit' from /usr/lib/ruby/1.8/net/http.rb:543:instart’ from
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in
transmit' fromexecute’ from
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in
execute' frompost’ from postEasy.rb:4
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient.rb:72:in
Any ideas?
Thanks in advance
You will need to nest the params in the
RestClient.postmethod. You’re most likely looking forparams[:product]in your action, but there won’t be any data for that. I tested on your heroku app, sorry for that, but this will work (as it does for me):