I have a file my_library.rb in the lib folder. class MyLibrary def auth(username,password) end end
I know it doesn't do anything yet, but I wanted to eliminate the possibility of errors in the method.
class MyController < ApplicationController require 'my_library' def index MyLibrary.auth("username","password") end ... end
As I try to invoke the auth method from the controller above I get this exception:
NoMethodError in Person summary requestsController#index
undefined method `auth' for MyLibrary:Class RAILS_ROOT: /Users/peterivie/AptanaProjects/AMC
Application Trace | Framework Trace | Full Trace app/controllers/person_summary_requests_controller.rb:16:in `index' -e:2:in `load' -e:2
I also tried MyLibrary::auth("username","password")
I am new to Ruby so I am probably missing something obvious. I am trying to create some code to download xml from a (non-rails) REST API.