Skip to content

Commit

Permalink
fix: include helpers if your controller either it inherits from Inher…
Browse files Browse the repository at this point in the history
…itedResources::Base or it calls inherit_resources method.
  • Loading branch information
jweslley committed Feb 19, 2011
1 parent c658d28 commit 2b4e34d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/inherited_resources_views.rb
Expand Up @@ -15,8 +15,22 @@
# helpers using the same method names, this is a very bad thing.
#
class InheritedResources::Base
instance_eval do
alias :inherit_resources_original :inherit_resources
end

def self.inherit_resources(base)
inherit_resources_original(base)
include_helpers(base)
end

def self.inherited(base)
super
include_helpers(base)
end

private
def self.include_helpers(base)
base.clear_helpers
base.helper ::ApplicationHelper, InheritedResourcesViews::Helper
end
Expand Down

0 comments on commit 2b4e34d

Please sign in to comment.