![]() | How do I read multiple json records using REST? |
|
23 Nov 2010, 17:35
Bill Tihen (8 posts) |
I would like to learn to elegantly read in data using a json feed into the aside server – instead of using multiple -d fields. I have changed aside into a quote server & the curl -i—url http://localhost:4567/quotes -d author=’Nike’ -d quote=’Just do it’ -X POST this works just fine, but I find the below code ugly & the curl command too. I would also like to use something like: curl -i—url http://localhost:4567/quotes.json -H “Content-Type: application/json” -X POST -d ‘{
If any one has ideas, I would appreciate that. Thanks, Bill |
|
23 Nov 2010, 17:36
Bill Tihen (8 posts) |
Here is the error to trying to load via json: 127.0.0.1 – - [23/Nov/2010 18:26:15] “GET /quotes:1 HTTP/1.1” 404 26 0.0005 Here is the code I was using: require ‘rubygems’ configure do
class Quote < ActiveRecord::Base validates_uniqueness_of :quote
helpers do
end
not_found do
status(404)
@msg || “I do not know about that!\n” |
| You must be logged in to comment |

