Module: Camping::Helpers

Included in:
Base, Views
Defined in:
lib/camping.rb

Instance Method Summary collapse

Instance Method Details

#/(p) ⇒ Object



6
7
# File 'lib/camping.rb', line 6

def/p
p[/^\//]?@root+p : p end

#errors_for(o) ⇒ Object



7
8
# File 'lib/camping.rb', line 7

def errors_for o;ul.errors{o.errors.each_full{|x|li x}
}if o.errors.any?end

#R(c, *g) ⇒ Object



3
4
5
# File 'lib/camping.rb', line 3

def R c,*g;p=/\(.+?\)/;g.inject(c.
urls.find{|x|x.scan(p).size==g.size}.dup){|s,a|s.sub p,C.escape((a[
a.class.primary_key]rescue a))}end

#URL(c = '/', *a) ⇒ Object



5
6
# File 'lib/camping.rb', line 5

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