I need the Ruby module FileUtils
to handle some operations with files.
I want to test that this require will work correctly in my controller. So I tried this in my console but got false
as a result (this works fine when I'm not in a Rails console but just a plain Ruby console):
- Go to the root directory of my project
$ rails c
to open my console> require 'fileutils'
returnsfalse
.
What is the correct way to require a module via rails console? Why would this return false?
I'm assuming in my controller I can just do something like this, correct?
def create
require 'fileutils'
# my code that uses fileutils.
end