Skip to content

Commit

Permalink
Allow setting more than :input in Camping.method_missing:
Browse files Browse the repository at this point in the history
Commit 3065665 introduced new behaviour of Camping.method_missing.
In 1.5 you could Nuts.get(:Index, :cookies => @cookies, :state => @State),
while in HEAD^ only :env and :input was picked up.

Thanks to Philippe Monnet for bug report.
  • Loading branch information
judofyr committed Jan 8, 2010
1 parent d4b6330 commit ff6db3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/camping-unabridged.rb
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,9 @@ def call(e)
def method_missing(m, c, *a)
X.M
h = Hash === a[-1] ? a.pop : {}
e = H[Rack::MockRequest.env_for('',h[:env]||{})]
e = H[Rack::MockRequest.env_for('',h.delete(:env)||{})]
k = X.const_get(c).new(e,m.to_s)
k.send("input=", h[:input]) if h[:input]
h.each { |i, v| k.send("#{i}=", v) }
k.service(*a)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/camping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def M;def M;end;constants.map{|c|k=const_get(c)
k,m,*a=X.D p,e['REQUEST_METHOD'].downcase
k.new(e,m).service(*a).to_a;rescue;r500(:I,k,m,$!,:env=>e).to_a;end
def method_missing m,c,*a;X.M;h=Hash===a[-1]?a.pop: {}
e=H[Rack::MockRequest.env_for('',h[:env]||{})]
k=X.const_get(c).new(e,m.to_s);k.send("input=",h[:input])if h[:input]
e=H[Rack::MockRequest.env_for('',h.delete(:env)||{})]
k=X.const_get(c).new(e,m.to_s);h.each{|i,v|k.send"#{i}=",v}
k.service(*a);end;def use*a,&b;m=a.shift.new(method(:call),*a,&b);meta_def(:call){|e|
m.call(e)}end end;module Views;include X,Helpers end;module Models
autoload:Base,'camping/ar';end;autoload:Mab,'camping/mab';C end

0 comments on commit ff6db3d

Please sign in to comment.