On Fri, 2004-10-22 at 23:36, Scott Barron wrote:> I consider vendor/ to be part of rails proper and I feel that you > shouldn''t really mess with thatAs far as I understand, vendor is for ANY third party sources that you do not change yourself (and probably check out from other CVS or manage on yours as a vendor branches). lib is for your own application code that doesn''t sensibly fit into other directories (e.g., you may have some utility classes, or a batch job, or something else that is not a part of MVC web application). The fact that contents of vendor are skipped by rdoc and statistics rake tasks (while contents of lib are not) seems to support this point of view (?) Best regards, Alexey Verkhovsky
Pardon me, I have read your email from right to left, it seems. Alex
I wrote some code witch will generate a menu on my page. I would like to put it as an external lib into my Rails application. Where should i put the file with the module to be seen by any controler by require statement. I saw some lib and vendor directories in example applications, but putting there my module and writing require "my_module" gives me an apache error and no clue in production.log. Jacek Sorry for my english...
On Fri, Oct 22, 2004 at 10:30:35PM +0200, Jacek wrote:> I wrote some code witch will generate a menu on my page. I would like to > put it as an external lib > into my Rails application. Where should i put the file with the module > to be seen by any controler by > require statement. I saw some lib and vendor directories in example > applications, but putting there my module and writing require > "my_module" gives me an apache error and no clue in production.log. > Jacek > Sorry for my english...Hi, You ought to be able to stick it in the lib/ directory and just require it in your controllers. For example, I have a file datawarehouse.rb which has a class that makes a call out to our Oracle db to get some junk, and in my controller I just call "require ''datawarehouse''" and all is good. I consider vendor/ to be part of rails proper and I feel that you shouldn''t really mess with that (unless you''re hacking on rails itself). The lib/ directory was added specifically for pulling in your own general classes. Are you getting an error with putting things in lib/ ? -Scott
On Thu, Oct 21, 2004 at 11:57:06PM +0300, Alexey Verkhovsky wrote:> On Fri, 2004-10-22 at 23:36, Scott Barron wrote: > > I consider vendor/ to be part of rails proper and I feel that you > > shouldn''t really mess with that > > As far as I understand, vendor is for ANY third party sources that you > do not change yourself (and probably check out from other CVS or manage > on yours as a vendor branches).Sure. By "shouldn''t really mess with that" I meant "do not change yourself".> lib is for your own application code that doesn''t sensibly fit into > other directories (e.g., you may have some utility classes, or a batch > job, or something else that is not a part of MVC web application).Yeah, that''s pretty much what I said ...> The fact that contents of vendor are skipped by rdoc and statistics rake > tasks (while contents of lib are not) seems to support this point of > view (?)Well, since we''re being pedantic, you''ll notice that in the Rakefile the appdoc task includes: doc/README_FOR_APP app/**/*.rb and the stats task includes: app/controllers app/helpers test/unit test/functionl You''ll find that lib/ is not included in either of those. Most Sincerely and Graciously, -Scott