title: Rails: Can't access a module in my lib directory
body: <p>I'd like to create a general purpose string manipulation class that can be used across Models, Views, and Controllers in my Rails application.</p>
  
  <p>Right now, I'm attempting to put a Module in my lib directory and I'm just trying to access the function in rails console to test it. I've tried a lot of the techniques from similar questions, but I can't get it to work.</p>
  
  <p>In my lib/filenames.rb file:</p>
  
  <pre><code>module Filenames
  
    def sanitize_filename(filename)
      # Replace any non-letter or non-number character with a space
      filename.gsub!(/[^A-Za-z0-9]+/, ' ')
  
      #remove spaces from beginning and end
      filename.strip!
  
      #replaces spaces with hyphens
      filename.gsub!(/\ +/, '-')
    end
  
    module_function :sanitize_filename
  
  end
  </code></pre>
  
  <p>When I try to call sanitize_filename("some string"), I get a no method error. When I try to call Filenames.sanitize_filename("some string"), I get an uninitilized constant error. And when I try to include '/lib/filenames' I get a load error.</p>
  
  <ol>
  <li><p>Is this the most conventional way to create a method that I can access anywhere? Should I create a class instead?</p></li>
  <li><p>How can I get it working? :)</p></li>
  </ol>
  
  <p>Thanks!</p>