Skip to content

Commit

Permalink
fixed alias method in controller/dsl to not blow the stack level for …
Browse files Browse the repository at this point in the history
…rubies other than 1.9.2
  • Loading branch information
njackson committed Sep 17, 2011
1 parent d9148b4 commit 45a199f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/controller/dsl.rb
Expand Up @@ -9,14 +9,13 @@ module ClassMethods
def extend_resource(resource_method, *extensions)
class_eval do
extensions.each do |extension|
alias_method :"#{resource_method}_without_#{extension}", resource_method
define_method(resource_method) do
define_method("#{resource_method}_with_#{extension}") do
send("#{resource_method}_without_#{extension}").tap do |obj|
extensions.each do |extension|
obj.extend(extension)
end
obj.extend(extension)
end
end
alias_method "#{resource_method}_without_#{extension}", resource_method
alias_method resource_method, "#{resource_method}_with_#{extension}"
end
end
end
Expand Down

0 comments on commit 45a199f

Please sign in to comment.