public
Description: resources_controller rails plugin: rc makes RESTful controllers fun
Homepage: http://plugins.ardes.com/doc/resources_controller
Clone URL: git://github.com/ianwhite/resources_controller.git
Click here to lend your support to: resources_controller and make a donation at www.pledgie.com !
Use clone to copy class methods in 1.8.7

In Ruby 1.8.7 (but not 1.8.6 or 1.9), Object#dup does not copy an
object's singleton methods.  CUrrently, resources_controller exposes
this difference with a duped module that lacks the included callback of
its original.  This can be worked around by simply invoking #clone
instead, which does not suffer from this problem.
Tim Pope (author)
Wed Nov 19 17:32:44 -0800 2008
commit  60b5f270ba2c22fd24e2a93c8f4468416da75374
tree    fd0d5d2979280fab24f9ce21458ad929b15a3120
parent  8457e5703f7c147a2444da62931841a28e456b31
...
16
17
18
19
 
20
21
22
...
36
37
38
39
40
 
...
16
17
18
 
19
20
21
22
...
36
37
38
 
39
40
0
@@ -16,7 +16,7 @@ module Ardes
0
       def include_actions(controller, options = {})
0
         options.assert_valid_keys(:only, :except)
0
         raise ArgumentError, "you can only specify either :except or :only, not both" if options[:only] && options[:except]
0
-        mixin = self.dup
0
+        mixin = self.clone
0
         action_methods_to_remove(options).each {|a| mixin.remove_action_method(a) }
0
         controller.send :include, mixin
0
       end
0
@@ -36,4 +36,4 @@ module Ardes
0
       end
0
     end
0
   end
0
-end
0
\ No newline at end of file
0
+end

Comments