I don''t know about gems, but I''d recommend you look into using
plugins. I
just wrote a pretty complicated plugin that contains a model. When the
plugin is installed, the model is available to the rest of the application.
In my case, the model in the plugin actually uses its own database
connection information (because it connects to a central SQL Server
database.)
I think a plugin would be useful for your case too. The book "Rails
Recipes"
has some information on using plugins and svn:externals to share models
among applications.
Let me know if I can be any help.
On 6/15/06, John-Mason P. Shackelford <jpshack@gmail.com>
wrote:>
> I presently am refactoring an a Rails App that has not only the
> standard RoR web front end, but also agents which share the same model
> and run on different machines. In the past the whole rails app was
> just deployed on other machines even though only the model was used. I
> am trying to improve the situation by extracting the model into a gem
> which depends only on ActiveRecord and then requiring the model gem in
> both my rails application and the agent.
>
> I am finding that my new model gem has a very similar structure to the
> rails app with some of the same pieces as the rails app, e.g. boot.rb,
> environment.rb, test_helper.rb, etc, albeit scaled down to just the
> ActiveRecord specific material. Perhaps this would be a good candidate
> for a generator eventually.
>
> One interesting by-product of this approach is that I expect my
> fixture data to be easier to maintain since instead of having fixtures
> for the unit tests, functional tests for the web, and tests for the
> agent all in the same files, these will naturally be broken down into
> three separate projects.
>
> In any case I am wondering if anyone else has travelled this road
> before and has any experiences they''d like to relate. Did it work
> pretty well over the long haul or should I turn back now?
>
> --
> John-Mason Shackelford
>
> Software Developer
> Pearson Educational Measurement
>
> 2510 North Dodge St.
> Iowa City, IA 52245
> ph. 319-354-9200x6214
> john-mason.shackelford@pearson.com
> http://pearsonedmeasurement.com
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060615/ac3a5b3c/attachment.html