diff --git a/lib/camping-unabridged.rb b/lib/camping-unabridged.rb index 28c95ba..b049641 100644 --- a/lib/camping-unabridged.rb +++ b/lib/camping-unabridged.rb @@ -304,7 +304,6 @@ def URL c='/',*a # end # module Base - include Helpers attr_accessor :input, :cookies, :env, :headers, :body, :status, :root Z = "\r\n" @@ -536,7 +535,7 @@ def M #:nodoc: end constants.map { |c| k=const_get(c) - k.send :include,C,Base,Models + k.send :include,C,Base,Helpers,Models r[0,0]=k if !r.include?k k.meta_def(:urls){["/#{c.downcase}"]}if !k.respond_to?:urls } diff --git a/lib/camping.rb b/lib/camping.rb index 1c30e96..00e5926 100644 --- a/lib/camping.rb +++ b/lib/camping.rb @@ -6,7 +6,7 @@ module Camping;Apps=[];C=self;S=IO.read(__FILE__).sub(/S=I.+$/,'') escape z}*"="}*"&": "")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, +end;module Base;attr_accessor:input,:cookies,:env,:headers,:body, :status,:root;def method_missing*a,&b;a.shift if a[0]==:render;m=Mab.new({},self) s=m.capture{send(*a,&b)};s=m.capture{send(:layout){s}} if /^_/!~a[0].to_s and m. respond_to?:layout;s end;def r s,b,h={};@status=s;@headers.merge!h;@body=b end @@ -29,7 +29,7 @@ def redirect*a;r 302,'','Location'=>URL(*a)end;Z="\r\n";def to_a;[@status,@body, "Status: #{@status}#{Z+@headers.map{|k,v|[*v].map{|x|[k,v]*": "}}*Z+Z*2}#{@body}" end;end;X=module Controllers;@r=[];class<