To call helpers, use the helper
object:
$ ./script/console
>> helper.number_to_currency('123.45')
=> "R$ 123,45"
If you want to use a helper that's not included by default (say, because you removed helper :all
from ApplicationController
), just include the helper.
>> include BogusHelper
>> helper.bogus
=> "bogus output"
As for dealing with controllers, I quote Nick's answer:
> app.get '/posts/1'
> response = app.response
# you now have a rails response object much like the integration tests
> response.body # get you the HTML
> response.cookies # hash of the cookies
# etc, etc
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…