Commit f9d6b89

mo khan <mo@mokhan.ca>
2013-03-31 04:30:58
update the post payload and wrap the attributes with a restaurant key
1 parent fc7be8e
Changed files (2)
app/controllers/location_controller.rb
@@ -22,7 +22,7 @@ class LocationController < UIViewController
       @add.enabled = false
       @text_field.enabled = false
       p @text_field.text
-      location = Location.new(@text_field, 1, 1)
+      location = Location.new(@text_field.text, 1, 1)
       location.save
     end
 
app/models/location.rb
@@ -9,7 +9,7 @@ class Location
 
   def save
     begin
-      BW::HTTP.post("http://localhost:3000/api/vi/restaurants", payload: {name: @name, latitude: @latitude, longitude: @longitude} ) do |response|
+      BW::HTTP.post("http://localhost:3000/api/v1/restaurants", payload: { restaurant: { name: @name, latitude: @latitude, longitude: @longitude } } ) do |response|
         p response
       end
     rescue Exception => e