How can I force require a file in the console?

6 views
Skip to first unread message

Charles Wang

unread,
Jul 25, 2010, 10:44:25 PM7/25/10
to rubyonra...@googlegroups.com
I use rails-3.0.0.beta3 and ruby-1.9.2-preview3.

I have defined some new methods in the application_controller.rb, and
need to test them in the consle.

If I changed some codes in the application_controller.rb.
I should always restart the console.

I have tried to use 'reload!' command, just dosen't work.

And then I use "require 'applicatioin.rb'",
still dosen't work.

Help! :(

Lux

unread,
Jul 26, 2010, 12:15:22 PM7/26/10
to Ruby on Rails: Talk
Well Application Controller is a class, so I think you would want to
do require "ApplicationController"

If that does not work you can always just paste the methods in and
call them. Kind of hacky but it works.

Marnen Laibow-Koser

unread,
Jul 27, 2010, 1:51:56 PM7/27/10
to rubyonra...@googlegroups.com

How are you trying to run your controller methods in the console?
What's the exact syntax you're using? Normally, you can't do this
easily...

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
--
Posted via http://www.ruby-forum.com/.

Reply all
Reply to author
Forward
0 new messages