Hi, Say I have a public facing website, and a separate admin-only website (that needs to be separate). They do need to share some, if not all, of the models and libraries. The simplest thing I can think of is to have the models and libraries somewhere separate, maybe in their own git repository as a submodule, then on deploy of each application, copy them into the app/lib directories. That seem reasonable? Joe --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Joe Van Dyk wrote:> Hi, > > Say I have a public facing website, and a separate admin-only website > (that needs to be separate). They do need to share some, if not all, > of the models and libraries. > > The simplest thing I can think of is to have the models and libraries > somewhere separate, maybe in their own git repository as a submodule, > then on deploy of each application, copy them into the app/lib > directories. > > That seem reasonable? > > Joe/project /public /admin /common you''ll have to deploy them in this structure but then add to both of your config/environment.rb config.load_paths += %W( #{RAILS_ROOT}/../common/app/models ) should work. -- 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 -~----------~----~----~----~------~----~------~--~---
On May 4, 6:46 pm, Matthew Rudy Jacobs <rails-mailing-l...@andreas- s.net> wrote:> Joe Van Dyk wrote: > > Hi, > > > Say I have a public facing website, and a separate admin-only website > > (that needs to be separate). They do need to share some, if not all, > > of the models and libraries. > > > The simplest thing I can think of is to have the models and libraries > > somewhere separate, maybe in their own git repository as a submodule, > > then on deploy of each application, copy them into the app/lib > > directories. > > > That seem reasonable? > > > Joe > > /project > /public > /admin > /common > > you''ll have to deploy them in this structure > > but then add to both of your config/environment.rb > > config.load_paths += %W( #{RAILS_ROOT}/../common/app/models ) > > should work.Makes sense, I''ll give it a try. Anyone done anything like this? The main reasons for this are: 1. Security. Easier to protect admin section of site if it''s not accessible via the public network. 2. Upgradability. We can upgrade the admin part of the site without affecting anything on the public one. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I have the following two URLs which are actually the same APP: http://www.flute-fidelity.com.au/ http://www.billyhydewoodwind.com.au/ I find it''s quite easy to get rails to switch functionality based on the URL that it gets driven from. Why not simply have two virtual hosts pointing to the same web app, and put some webserver rules on one for being local only, and on the other for being public only. Then, the rails app can know whether or not to honour its admin side or not. Makes it easier for development than messing around with multiple apps accessing the same codebase (i''ve done that before, too, and it''s a bit on a nightmare). Julian. Learn Ruby on Rails! Check out the FREE VIDS (for a limited time) VIDEO #4 coming soon! http://sensei.zenunit.com/ On 05/05/2008, at 11:42 AM, Joe Van Dyk wrote:> > Hi, > > Say I have a public facing website, and a separate admin-only website > (that needs to be separate). They do need to share some, if not all, > of the models and libraries. > > The simplest thing I can think of is to have the models and libraries > somewhere separate, maybe in their own git repository as a submodule, > then on deploy of each application, copy them into the app/lib > directories. > > That seem reasonable? > > Joe > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Joe, why the application *needs* to be "physically" separated into two standalone Rails apps? Security concerns, separate developers, or ...? You probably set yourself for couple of troubles this way. If you really need them to be separate, I''d suggest to put shared logic into a standard Rails plugin. Karel -- www.karmi.cz On May 5, 3:42 am, Joe Van Dyk <joevan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Say I have a public facing website, and a separate admin-only website > (that needs to be separate). They do need to share some, if not all, > of the models and libraries. > > The simplest thing I can think of is to have the models and libraries > somewhere separate, maybe in their own git repository as a submodule, > then on deploy of each application, copy them into the app/lib > directories. > > That seem reasonable? > > Joe--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
beholdthepanda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-May-05 12:12 UTC
Re: Having two rails apps share the same models
I have a similar situation where I have one application that acts as a portal to 3 other applications. The portal application''s database is VERY bare-bones and holds the minimum amount of information for my shared models. (Like users) We turned our models into a plugin and had all the apps bring in the plugin as an SVN external. class User < ActiveRecord::Base unloadadable self def self.table_name "*YOURAPPSNAME_" + ENV["RAILS_ENV"] + "." + "users" end .... end So far this is serving us well - there are a few gotchas (some expected, some not expected).... All the DBs need to be on the same machine using this approach...even though they are different databases. Also - it makes any changes to that plugin cascade across all your applications - so you need to account for the way your applications interface with those models. One major boost we''re seeing out of this approach is the ability to decorate models in each one of the application. So a user may get new methods and associations in application1 - we can easily make a UserDecorator module in our /lib folder to give the user these methods and associations. Have you looked into sharing models between your apps using ActiveResource? http://railscasts.com/episodes;archive (episodes 94 and 95) On May 4, 9:42 pm, Joe Van Dyk <joevan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Say I have a public facing website, and a separate admin-only website > (that needs to be separate). They do need to share some, if not all, > of the models and libraries. > > The simplest thing I can think of is to have the models and libraries > somewhere separate, maybe in their own git repository as a submodule, > then on deploy of each application, copy them into the app/lib > directories. > > That seem reasonable? > > Joe--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> Have you looked into sharing models between your apps using > ActiveResource?http://railscasts.com/episodes;archive (episodes 94 and 95)Assuming that you absolutely must separate into two applications, this would be my recommendation. The admin side of things should be the lower-traffic side so I''d suggest using ActiveResource there to access the objects in the public app.> why the application *needs* to be "physically" separated into two > standalone Rails apps? Security concerns, separate developers, or ...?Karel does ask a good question. It''s also reasonable to use the map.namespace options to create an admin area in the site. It could use whatever authentication/authorization scheme you want so you could secure it in a different way than your public site. Certainly this would be easier than supporting separate apps. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---