Sha256: 1c27d5a569ab56fd79f2b9370945bd1854d598776eea425294da0f807f800a7b

Contents?: true

Size: 604 Bytes

Versions: 9

Compression:

Stored size: 604 Bytes

Contents

class Module
  def include_all_modules_from(parent_module)
    parent_module.constants.each do |const|
      mod = parent_module.const_get(const)
      if mod.class == Module
        send(:include, mod)
        include_all_modules_from(mod)
      end
    end
  end
end

def helper(*helper_names)
  returning @helper_proxy ||= Object.new do |helper|
    helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize }
  end
end

require_dependency 'application'

class << helper 
  include_all_modules_from ActionView
end

@controller = ApplicationController.new
helper :application rescue nil

Version data entries

9 entries across 9 versions & 4 rubygems

Version Path
radiant-0.7.2 vendor/rails/railties/lib/console_with_helpers.rb
usher-0.7.0 spec/rails2_2/vendor/rails/vendor/rails/railties/lib/console_with_helpers.rb
rails-2.2.3 lib/console_with_helpers.rb
erails-2.1.2 lib/console_with_helpers.rb
radiant-0.7.0 vendor/rails/railties/lib/console_with_helpers.rb
radiant-0.7.1 vendor/rails/railties/lib/console_with_helpers.rb
rails-2.1.1 lib/console_with_helpers.rb
rails-2.1.2 lib/console_with_helpers.rb
rails-2.2.2 lib/console_with_helpers.rb