简体   繁体   中英

Ruby on Rails module require issue

I'm divin to the Rails 3 via some tutorials. I found usefull the lynda.com/Kevin Skoglund's Rails 3 Essential training. Close to the end of the course I run into a problem what I can't solve and no reference found on the net (or lynda's site).

There is a position_mover (similar to act_as_list, but simpler) module what I must include to the model's to use. But I'm getting errors. This one:

LoadError in SubjectsController#index

no such file to load -- lib/position_mover
Rails.root: C:/Programozas/work/simple_cms

Application Trace | Framework Trace | Full Trace
app/models/subject.rb:1:in `<top (required)>'
app/controllers/subjects_controller.rb:13:in `list'
app/controllers/subjects_controller.rb:8:in `index'
This error occurred while loading the following files:
lib/position_mover
Request

Parameters:

None
Show session dump

Show env dump

Response

Headers:

None

I have access to the example files also. I tried to hard copy the whole app, than modify the gems versions to be correct and I get the same error. The app runs perfectly untill I try to access a model, where the require presented.

A model:

require 'lib/position_mover'
class Subject < ActiveRecord::Base

include PositionMover

has_many :pages
...
end

I'm sure this is a kind of mega easy thing what I can't recognise. Please help to identify the problem, Yours, Kael

What if you remove the lib/ part? If the gem is in your Gemfile it is not even necessary to require it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM