mirror of
https://github.com/github/rails.git
synced 2026-01-30 00:38:00 -05:00
Extend the console +helper+ method to allow you to include custom helpers. Closes #6781 [Chris Wanstrath]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7765 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
*SVN*
|
||||
|
||||
* Extend the console +helper+ method to allow you to include custom helpers. e.g:
|
||||
>> helper :posts
|
||||
>> helper.some_method_from_posts_helper(Post.find(1))
|
||||
|
||||
* db:create works with remote databases whereas db:create:all only creates
|
||||
databases on localhost. #9753 [Trevor Wennblom]
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@ class Module
|
||||
end
|
||||
end
|
||||
|
||||
def helper
|
||||
@helper_proxy ||= Object.new
|
||||
def helper(*helper_names)
|
||||
returning @helper_proxy ||= Object.new do |helper|
|
||||
helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize }
|
||||
end
|
||||
end
|
||||
|
||||
require 'application'
|
||||
@@ -21,3 +23,4 @@ class << helper
|
||||
end
|
||||
|
||||
@controller = ApplicationController.new
|
||||
helper :application rescue nil
|
||||
|
||||
Reference in New Issue
Block a user