Elliott Blatt
2007-Mar-23 15:29 UTC
How to share a collection of model files across many apps?
Hi, I''ve got three files that (a.rb, b.rb, c.rb) that currently live in app/models. I''d like these models to shared by multiple rails apps. These models are associated with a separate database. My rails projects are contained in a directory that looks like this: projects/ proj1/ proj2/ proj3/ common/ common/ a.rb b.rb c.rb My idea is to do this: In proj1/lib/, symlink to ../../common/ lib/ common/ (which is a symlink) My question is: How do I tell rails to load the files pointed to by the symlink named ''common'' in the lib directory? I''ve tried: cofig/environment.rb include ''lib/common'' Thanks for your input. EB -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Russell Norris
2007-Mar-23 18:22 UTC
Re: How to share a collection of model files across many apps?
Are they not loading just by virtue of being in lib? I dunno. If not, then you should be able to modify that little piece of the environment.rb that says # config.load_paths += %W( #{RAILS_ROOT}/extras ) to suit your needs. I''d hope. RSL On 3/23/07, Elliott Blatt <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > > > Hi, > > I''ve got three files that (a.rb, b.rb, c.rb) that currently live in > app/models. > I''d like these models to shared by multiple rails apps. These models are > associated with a separate database. > > My rails projects are contained in a directory that looks like this: > > projects/ > > proj1/ proj2/ proj3/ common/ > > > common/ > a.rb b.rb c.rb > > > My idea is to do this: > > In proj1/lib/, symlink to ../../common/ > > lib/ > common/ (which is a symlink) > > > My question is: > How do I tell rails to load the files pointed to by the symlink named > ''common'' in the lib directory? > > > I''ve tried: > > cofig/environment.rb > > include ''lib/common'' > > Thanks for your input. > EB > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---