John Mettraux wrote:
> On Wed, May 26, 2010 at 10:09:30AM +0200, Torsten Schönebaum wrote:
> >
> > > Why not doing it the CouchDB style :
> > >
> > > GET /_ruote/workitems?wands={"value":101,"type":"Integer"}
> >
> > That's a great idea. Using JSON's native types, we can even drop the
> > "type" key.
> >
> > > ~~>
> > >
> > > GET
> > > /_ruote/workitems?wands=%7B%22value%22%3A101%2C%22type%22%3A%22Integer%22%7D
> > >
> > > require 'cgi'
> > > CGI.escape('{"value":101,"type":"Integer"}')
> > >
> > > Granted, the simplest cases now become
> > >
> > > GET /_ruote/workitems?customer=%22Torsten%22
> > >
> > > but we could perhaps also accept the plain
> > >
> > > GET /_ruote/workitems?customer=Torsten
> > >
> > > without too much worries (if the first char of the value is a % then we
> > > know we have to deal with something escaped, else let's assume it's a
> > > String).
> >
> > Sinatra does the url decoding and some parsing on the params so that we
> > always get an hash of strings (or even sub-hashes). We could have a look
> > at the raw data but I suppose it's easier to check if there are curly
> > brackets at the beginning and the end of the filter value and let
> > JSON.parse do its work in those cases.
> >
> > My first try on that is in
> > http://github.com/tosch/ruote-kit/commit/a9dc84e7ccd71e0e78d4262ed8be31ea29497620
>
> Hello Torsten,
>
> looks great.
>
>
> May I suggest to use
>
> Rufus::Json.encode(stuff)
>
> and
>
> Rufus::Json.decode(json_string)
>
>
> rufus-json is a already a dependency of ruote.
>
> For more info :
>
> http://github.com/jmettraux/rufus-json/
>
> It automatically picks the best JSON lib present. It favours yajl-ruby
> which is very fast. It's especially important in those days of borked
> json gem.
Replaced the dependency for the json gem with rufus-json:
http://github.com/tosch/ruote-kit/commit/a3f781989cd17ce63bdfc44580e8c920d4b6b08b
Users will have to make sure a json backend is loaded, though. When
using the source (not the gem!), rackup will try to load yajl-ruby and
json (in that order). Specs are pinned to use the json gem atm.
Ruote-on-rails should work out of the box, since the ActiveSupport
backend is available. Only when using the gem version of RuoteKit,
manual action is needed.
Yours,
Torsten
--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en