Skip to content

Commit

Permalink
* lib/camping.rb: R(C, ...) wasn't escaping at all.
Browse files Browse the repository at this point in the history
  • Loading branch information
_why committed May 21, 2006
1 parent 2989e76 commit 00e28ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/camping-unabridged.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ module Helpers
def R(c,*args)
p = /\(.+?\)/
args.inject(c.urls.find{|x|x.scan(p).size==args.size}.dup){|str,a|
str.sub(p,(a.__send__(a.class.primary_key) rescue a).to_s)
str.sub(p,C.escape((a.__send__(a.class.primary_key) rescue a)))
}
end
# Shows AR validation errors for the object passed.
Expand Down
4 changes: 2 additions & 2 deletions lib/camping.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
%w[rubygems active_record markaby metaid tempfile uri].each{|l|require l}
module Camping;C=self;F=__FILE__;S=IO.read(F).gsub(/_+FILE_+/,F.dump)
module Helpers;def R c,*args;p=/\(.+?\)/;args.inject(c.urls.find{|x|x.scan(p).
size==args.size}.dup){|str,a|str.sub(p,(a.__send__(a.class.primary_key)rescue
a).to_s)} end;def URL c='/',*a;c=R(c,*a)if c.respond_to?:urls;c=self/c;c=
size==args.size}.dup){|str,a|str.sub(p,C.escape((a.__send__(a.class.primary_key
)rescue a)))} end;def URL c='/',*a;c=R(c,*a)if c.respond_to?:urls;c=self/c;c=
"//"+@env.HTTP_HOST+c if c[/^\//];URI(c) end;def / p;p[/^\//]?@root+p:p end
def errors_for o;ul.errors{o.errors.each_full{|x|li x}}if o.errors.any? end end
module Base;include Helpers;attr_accessor :input,:cookies,:env,:headers,:body,
Expand Down

0 comments on commit 00e28ef

Please sign in to comment.