Forum: Rails Engines development What's up with the lib folder?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Seth (Guest)
on 2006-01-04 21:54
I noticed I have a structure like this...


Inside of .../lib I also have a my_engine.rb

What's the purpose of this? I can't find anything on the wiki about it.

James A. (Guest)
on 2006-01-05 01:54
(Received via mailing list)
The structure you have is very general, since it's most likely from
the generator. The thought is that you have a single point of
inclusion for your engine libraries, so you can simply do

  require 'my_engine'

which will load the file "my_engine/lib/my_engine.rb". To keep things
tidy, any library code that you define should be placed in
my_engine/lib/my_engine/, but equally you might have other libraries
in my_engine/lib/whatever.

Of course, it's totally up to you what you place in lib, and what
structure you use - the only thing that is even semi-expected is that
you have an init_engine.rb (and that's not even necessary).

Sorry if that explanation isn't clear, it's quite late :)

- james
This topic is locked and can not be replied to.