Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7765

Show
Ignore:
Timestamp:
10/07/07 03:08:08 (10 months ago)
Author:
nzkoz
Message:

Extend the console +helper+ method to allow you to include custom helpers. Closes #6781 [Chris Wanstrath]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/railties/CHANGELOG

    r7718 r7765  
    11*SVN* 
     2 
     3* Extend the console +helper+ method to allow you to include custom helpers.  e.g: 
     4  >> helper :posts 
     5  >> helper.some_method_from_posts_helper(Post.find(1)) 
    26 
    37* db:create works with remote databases whereas db:create:all only creates 
  • trunk/railties/lib/console_with_helpers.rb

    r4019 r7765  
    1111end 
    1212 
    13 def helper 
    14   @helper_proxy ||= Object.new  
     13def helper(*helper_names) 
     14  returning @helper_proxy ||= Object.new do |helper| 
     15    helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize } 
     16  end 
    1517end 
    1618 
     
    2224 
    2325@controller = ApplicationController.new 
     26helper :application rescue nil