I am very new to Rails and web development.
I am creating a bunch of objects in Matlab, and I would like to send these objects to the database in my Rails application. Can anyone advise me how to do this?
So far, at the end of Rails, I have created basic scaffolding for my data. I can add objects to my database using the form in '/ myobjects / new'.
At the end of Matlab, I try to add objects using HTTP POST requests, for example:
s = urlread('http://localhost:3000/myobjects.json','POST',{'myobject','{name1:''value1''}'})
This fails and displays the following on the Rails console:
Started POST "/myobjects.json" for 127.0.0.1 at 2012-06-16 11:48:28 -0400 Processing by MyobjectsController#create as JSON Parameters: {"myobject"=>"{name1:'value1'}"} WARNING: Can't verify CSRF token authenticity Completed 500 Internal Server Error in 1ms NoMethodError (undefined method `stringify_keys' for "{name1:'value1'}":String): app/controllers/myobjects_controller.rb:43:in `new' app/controllers/myobjects_controller.rb:43:in `create'
This approach may not work, but hopefully the code above makes my goal clear. Can someone tell me how to fix my code, or suggest a better strategy for putting my data on the rails?
EDIT
At the moment, my new and created methods look like this (but I can change them as needed)
source share