MultiPart POST with Image Upload Script
require 'rest_client'
 @image1 =  { :file =>  File.new("spec/support/labrador.jpg") }
 @images = [ {@image1} ]
 @params = {:name => "Test", :description => "aaaa",
                          :website => "http://something.com",
                          :unlocked_time => "00:30:00", 
                          :company_id => "1",
                          :image_url => "aaaaaa",
                          :images_attributes => @images
         }
url = "http://localhost:3000/api/products"
begin
  response = RestClient.post url,{ :product => @params }
  p response.to_str
  rescue => e
   p e.response
endWritten by Rajeev N Bharshetty
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Ruby 
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#

 
 
 
 
