public
Description: Merb Plugins: Even more modules to hook up your Merb installation
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-plugins.git
Make the auto-method check compatible with Sequel
Michael Sheakoski (author)
Mon Sep 01 14:34:50 -0700 2008
commit  0ebf4890d4afa255030d73848123d085a78b37da
tree    b46623cb3540bb915bb145c3df962f63ec31896f
parent  bf909da0336156982c58acb94224756a5e852f23
...
33
34
35
36
37
 
 
38
39
40
...
33
34
35
 
 
36
37
38
39
40
0
@@ -33,8 +33,8 @@ module Merb::Helpers::Form::Builder
0
       # Unless the method is :get, fake out the method using :post
0
       attrs[:method] = :post unless attrs[:method] == :get
0
       # Use a fake PUT if the object is not new, otherwise use the method
0
-      # passed in.
0
-      method ||= (@obj && !@obj.new_record? ? :put : :post)
0
+      # passed in. Defaults to :post if no method is set.
0
+      method ||= (@obj.respond_to?(:new_record?) && !@obj.new_record?) || (@obj.respond_to?(:new?) && !@obj.new?) ? :put : :post
0
 
0
       attrs[:enctype] = "multipart/form-data" if attrs.delete(:multipart) || @multipart
0
 

Comments