I have two rails applications that modify/view the same data. Is there a DRY way of sharing a model (not just database) between two separate applications? -- Mike
You can use svn:externals if you''re using subversion. One thing I''d like to know from people with more experience is how to package up unit tests when using svn:externals. I have a couple models that I store in a lib dir external to all my projects, but I''m not sure how to handle unit tests. Pat On 1/20/06, Mike Douglas <mike.douglas@gmail.com> wrote:> I have two rails applications that modify/view the same data. Is there > a DRY way of sharing a model (not just database) between two separate > applications? > > -- > Mike > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
I would be pretty interesting if you did some drb experiments on this topic... could be the, dare i say, ejb of rails... M Mike Douglas wrote:> I have two rails applications that modify/view the same data. Is there > a DRY way of sharing a model (not just database) between two separate > applications?-- Posted via http://www.ruby-forum.com/.
Mike Douglas wrote:> I have two rails applications that modify/view the same data. Is there > a DRY way of sharing a model (not just database) between two separate > applications?Ran into this not long ago. We have one main database, and at present are running three main apps off of it. Here is the setup on our server: www - main_app - side_app - side_app_2 So, both side apps need to share the models from the main app. So what I did was remove any models from the side_app that needed to be shared from the main app. Then, in each side app''s environment.rb I added this: if ENV[''RAILS_ENV''] == ''production'' config.load_paths += %W( /home/user/www/main_app/app/models ) else config.load_paths += %W( /users/user/sites/main_app/app/models ) end This needs to go in the Rails Initiator block in environment.rb (look for the commented config.load_paths line) The first part of the conditional makes sure the production box loads the models from the main app, the second part makes sure it works on my development machine. A few caveats: You are only sharing the models, so tests aren''t along for the ride. I am assuming you can do the same thing and add the tests folder to the load path as well. Also, any changes to the main app''s models requires a restart of all dependent apps, obviously. -- Posted via http://www.ruby-forum.com/.
On 20/01/06, Pat Maddox <pergesu@gmail.com> wrote:> > You can use svn:externals if you''re using subversion. > > One thing I''d like to know from people with more experience is how to > package up unit tests when using svn:externals. I have a couple > models that I store in a lib dir external to all my projects, but I''m > not sure how to handle unit tests. >Have you tried making an engine out of common models? I think I have seen a patch allowing to unit-test engines so this should be a perfect solution. -- ?ukasz Piestrzeniewicz -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060120/d12a903c/attachment.html
No, save us, no! On 1/20/06, mikkel <mikkel@helenius.dk> wrote:> > I would be pretty interesting if you did some drb experiments on this > topic... > > could be the, dare i say, ejb of rails... > > M > > Mike Douglas wrote: > > I have two rails applications that modify/view the same data. Is there > > a DRY way of sharing a model (not just database) between two separate > > applications? > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Skott Klebe skottk@gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060120/3cdb7fc3/attachment.html
Engines provide some support for testing out of the box, although it could be improved, with suggestions. - james On 1/20/06, ?ukasz Piestrzeniewicz <bragi.ragnarson@gmail.com> wrote:> Have you tried making an engine out of common models? I think I have seen a > patch allowing to unit-test engines so this should be a perfect solution.