Error: cannot load such file

Hello,

I am again looking for some guidance as an inexperienced programmer. I
appreciate the help. I would like to run a number of ruby files from
within rails. They are all different, but return information in a hash
(gen_output) in a standard format that my model in rails needs to use.
I am storing the files in a folder in “lib”. The files can be as basic
as 1+2=3, with 3 being returned in the hash.

This is in my model:
require ‘lib/generators/parks_bielkowski_test.rb’

 formatted = {
   :complete_question => gen_output["complete_question"]
   }
 formatted

I get this error:
cannot load such file – lib/generators/parks_bielkowski_test.rb

Do I need to do something to the files themselves?

Thanks
DC

Whoops, stupid error…

require “#{RAILS_ROOT}/lib/generators/parks_bielkowski_test.rb” works!

Thanks anyway

DC

config.autoload_paths
should include ‘lib’ to load you code - it is strange that this isn’t
happening.

Rails.root is what we use in rails 2

On Sun, Mar 13, 2011 at 9:00 AM, Dave C.
[email protected]wrote:


You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


make haste slowly
festina lente \

mobile +1_415_632_6001
[email protected] [email protected]
http://robotarmyma.de

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs