I have created a simple module and placed it in the lib directory and have included in the controller file.
below is the controller code.
class UserController < ApplicationController
include Departments
def create
user_data = Hash.new
user_data["data"] = "hello world!"
user_data["price"] = 12
render :json => user_data
end
end
when i try to execute it i see the below error
ActionController::RoutingError (uninitialized constant UserController:: Departments):
I have searched forums and see that adding
config.autoload_paths += %W(#{config.root}/lib)
solves the issue, but it did not in my case. I am using Rails 4.2.7.1 and ruby ruby 1.9.3p547.
Can anyone point out what could be the issue, Thanks.