Harry
Harry

Reputation: 1699

Rails Undefined Method include when including a module in `lib` dir

I cannot load my PactHelper module from my lib dir.

# lib/pact_helper.rb

module PactHelper
    def so_something

    end
end

and

# app/controllers/registrations_controller.rb

class RegistrationsController < ApplicationController

    include PactHelper

    def new
        ...
    end
end

returns undefined method 'include' for #<RegistrationsController:0x5287cf8>

Could someone explain to me why my module is not being included?

Upvotes: 3

Views: 2157

Answers (1)

John
John

Reputation: 74

Try:

require 'pact_helper.rb'

Above:

class RegistrationsController < ApplicationController

In:

registrations_controller.rb

Upvotes: 3

Related Questions