I am relatively new to Ruby on Rails, but I have almost completed the online course on Lynda. I am stuck on 14-5 "Using the positionMove module". The tutorial is in Rails 3 while my version is Rails 4. I have the solution code, however it does not work for me. I have put my file position_mover.rb in the lib directory. Then in my subject model I require and include the module like this:
require 'lib/position_mover'
class Subject < ActiveRecord::Base
include PositionMover
...
end
I used the methods in this model in the Subject controller just like the instructor. However, when I go to run my app on the Subjects index page I get the error:
cannot load such file -- lib/position_mover
app/models/page.rb:1:in `<top (required)>'
app/views/subjects/list.html.erb:23:in `block in_app_views_subjects_list_html_erb__420960863_60005508'
app/views/subjects/list.html.erb:18:in `_app_views_subjects_list_html_erb__420960863_60005508'
app/controllers/subjects_controller.rb:9:in `index'
I have tried many different approaches that I found online such as adding it to the class definition (Ruby on Rails 4.0 - Loading and using a module) or moving it to a different directory and specifying the path. How do I achieve the same result in Rails 4? What am I doing wrong? Any help is greatly appreciated.