Forum: Ruby on Rails using a helper from the console

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Kevin Olbrich (Guest)
on 2006-05-24 19:09
(Received via mailing list)
I've got a couple of helper functions in my application_helper file that
I would like to run from the console (for debugging).

What is the correct way to invoke a helper from the console?

6cb63c760f5f39f514eece6cb1ee820d?d=identicon&s=25 Simon King (Guest)
on 2006-07-28 15:29
(Received via mailing list)
I've got a similar question - I want to run a method defined in
ApplicationHelper on the console, but using helper.method() doesn't
work. Should it?


On 24 May 2006 17:07:56 -0000, Kevin Olbrich
Cb2b768a5e546b24052ea03334e43676?d=identicon&s=25 Dr Nic (nicwilliams)
on 2006-07-28 15:34
load 'application_helper.rb'

and then just call the functions in the module.

If you make changes to the file, just retype the line.

D2b2017098da3e2fd1cdcfbb72ecdbfb?d=identicon&s=25 Jason Edgecombe (Guest)
on 2006-07-28 15:40
(Received via mailing list)
normally, you cannot run helpers or controllers through rails console;
however, you can add this by editing the console script and added the
following line:
require File.dirname(__FILE__) + "/../config/environment.rb"
after the line that requires boot.rb

I found this out from

The link is about backgroundrb, but the premise is the same.

This topic is locked and can not be replied to.