*Here is my code, *
def create
forrest= Hash.new
forrest["name"]= params[:name]
forrest["country_code"]= params[:country_code]
forrest["state"]= params[:state]
forrest["city"]= params[:city]
forrest["province"]= params[:province]
forrest["zip_code"]= params[:zip_code]
forrest["phone"]= params[:contact_number]
forrest["email"]= "v@gmail.com"
forrest["business_id"]= "12"
begin
* response = RestClient.post
''http://localhost:3001/branches'',
forrest.to_json, :content_type => :json, :accept => :json*
case response
when 200
puts "success"
when 201
puts "created"
else
puts "failed....."
end
* rescue => e*
* puts "showing the fail......"*
* end*
end
Here got all the values from the form, then i have to pass that all
values into restclient. But now i getting error "*showing the
fail......"*any thing problem with restclient post method
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/myCLEFjaCQgJ.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Feb 28, 2012 at 10:43 AM, amvis <vgrkrishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: ...> * response = RestClient.post ''http://localhost:3001/branches'', > forrest.to_json, :content_type => :json, :accept => :json* > case response > > when 200 > puts "success" > when 201 > puts "created" > else > puts "failed....." > > end > > * rescue => e* > * puts "showing the fail......"* >Make that: puts "Error: #{e.inspect}" and you will get more info about the problem HTH, Peter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.