3

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

5
  • 5
    What if you remove the lib/ part? If the gem is in your Gemfile it is not even necessary to require it. Commented Jun 7, 2011 at 7:44
  • 1
    What mischa said, plus requireing stuff in a model is just bad. Keep it to initializers, or at least within the config/ directory. Also: if the app tells you the file does not exist, then the file does not exist. Read the fine manual. Commented Jun 7, 2011 at 11:24
  • 1
    Mischa: tx dude, I love you. Your reply solved the problem. I know, pay forvard, but I can't up your answer so thank you. Commented Jun 7, 2011 at 12:28
  • @mischa you could add your answer as an answer and @kael can check it as the right one so you both win. Commented Jun 7, 2011 at 15:25
  • @Tim, OK, I'll add it. @Kael, added my comment as an answer, so you can accept it. Commented Jun 7, 2011 at 23:01

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.