Miles Keaton
2004-Dec-30 22:56 UTC
anyone using their Models for other things besides initial Rails app?
Is anyone using their Ruby files created in /models/ for other things besides that initial Rails app? 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?
Michael Koziarski
2004-Dec-30 23:50 UTC
Re: anyone using their Models for other things besides initial Rails app?
On Thu, 30 Dec 2004 14:56:40 -0800, Miles Keaton <mileskeaton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers Koz
Austin Moody
2004-Dec-31 12:55 UTC
Re: anyone using their Models for other things besides initial Rails app?
Here at work I have the following: * A Rails app running on a Linux server. * Backend Ruby scripts that do other processing related to the Rails app (some interfaces with outside entities, etc....). There are a couple of different linux boxes, and one AIX server that these run one. All of the above need the same models, so I created a RubyGem of them all together. That way I can just require this gem in my Rails app as well as any other Ruby script that needs the model. This may not be the best way to do it, but it has been the easiest so far for me and hasn''t presented any problems yet. If something needs changed in the model I just have to re-build my gem and then run ''gem update'' on my servers. --austin On Thu, 30 Dec 2004 15:50:28 -0800, Michael Koziarski <koziarski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, 30 Dec 2004 14:56:40 -0800, Miles Keaton <mileskeaton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Cheers > > Koz > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >