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

Efe398b3b5436b0a8d4430090e8f86ea?d=identicon&s=25 Seth (Guest)
on 2006-01-04 20:54
I noticed I have a structure like this...

.../plugins/my_engine/lib/my_engine

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.

Thanks.
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-01-05 00: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.