Skip to content

Instantly share code, notes, and snippets.

@sumitasok
Created September 22, 2012 06:59
Show Gist options
  • Save sumitasok/3765405 to your computer and use it in GitHub Desktop.
Save sumitasok/3765405 to your computer and use it in GitHub Desktop.
Module included
class UserDefined
module ActionController # :nodoc: all
def self.included(base)
base.send :helper_method, :user_method
end
private
def user_method
@user_defined ||= UserDefined.new(
:var => 'value',
:variable => 'variable'
)
end
end
end
ActionController::Base.send :include, UserDefined::ActionController
class UserDefined
# Add Rails helper if ActionController::Base is defined
require "folder/action_controller" if defined?(ActionController::Base)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment