[Rails] anyone using their Models for other things besides initial Rails app?

Michael Koziarski koziarski at gmail.com
Thu Dec 30 23:50:28 GMT 2004


On Thu, 30 Dec 2004 14:56:40 -0800, Miles Keaton <mileskeaton at gmail.com> wrote:
> Is anyone using their Ruby files created in /models/ for other things
> besides that initial Rails app?

Here's what I've done so far:

* rails website for the  users (me and a few others)
* ruby scripts from cron for admin  etc.

This is the beauty of encapsulating all your logic in the one place. 
As far as implementation goes, I use subversion to store all the
source and externals to link them together (probably an easier way
...).

In your shell scripts you'll need to establish_connection before the
AR calls can work:

http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M000283


> What if you want to have two different Rails projects shaing the
> *exact* same models?   Use unix's symlinks?
> 
> Some scenarios I'm imagining:
> 
> * - a website, available to public, uses models for person, record,
> transaction, etc.
> 
> * - back-end intranet, used inside the office for running the
> business, would need exact same models, to make sure business rules
> are identical, though an entirely different website for employees to
> use.
> 
> * - shell scripts, run by cron, that parse or email reports to clients
> without needed a human to click on a web page.
> 
> What would you guys recommend for a setup like this?
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
> 


-- 
Cheers

Koz


More information about the Rails mailing list