Ronald Evangelista
2008-May-08 14:58 UTC
query strings built by R method can''t handle multiple values from checkbox selections
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 }*"&" -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20080508/7147a02a/attachment-0001.html>
John Beppu
2008-May-09 00:04 UTC
query strings built by R method can''t handle multiple values from checkbox selections
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 <ironald at gmail.com> 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 > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20080508/f3653fe4/attachment.html>
Maybe Matching Threads
- R(c,*g) helper method can''t handle nested hash input params
- new winetricks 20080314: added vcrun2003, improved dotnet11, fixed gui multiple selections
- Multiple geometry, selections and georss
- Selections from tcltk list boxes
- looking for Variable selections models, techniques, methods