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

Posted by 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.
Posted by 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.