As an side, I'm writing a Camping-like framework in Perl, and R() is still
on my to-do list.
I'm glad you posted this, because I probably would've ended up duplicating
that bug in my translation to Perl.
--beppu
On Thu, May 8, 2008 at 7:58 AM, Ronald Evangelista <[EMAIL PROTECTED]>
wrote:
> query strings built by R method can't handle multiple values from checkbox
> selections
>
> R(SomeRoute, :reply_status=>%w{1 2 4})
> should return
> query_string="
> http://localhost:3301/someroute/?reply_status_id=1&reply_status_id=2&reply_status_id=4
> "
>
> qsp(query_string) -> {"reply_status_id"=>["1", "2", "4"]}
>
>
> from camping_unabridged.rb
> def R(c,*g)
> p,h=/\(.+?\)/,g.grep(Hash)
> g-=h
> raise "bad route" unless u = c.urls.find{|x|
> break x if x.scan(p).size == g.size &&
> /^#{x}\/?$/ =~ (x=g.inject(x){|x,a|
> x.sub p,C.escape((a[a.class.primary_key]rescue a))})
> }
> h.any?? u+"?"+h[0].map{|x|x.map{|z|C.escape z}*"="}*"&": u
> end
>
> ----
> i think it would work if modified as:
>
> h[0].map{|x|
> k, v=x
> if v.is_a?Array
> v.map{|v2| [C.escape( k), C.escape( v2)]*"="} * "&"
> else
> x.map{|z| C.escape z}*"="
> end
> }*"&"
>
>
>
> _______________________________________________
> Camping-list mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/camping-list
>
_______________________________________________
Camping-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/camping-list