Robert Jones
2006-Jul-01 09:26 UTC
[Rails] Seeking Advice on Pattern for Multi-Organization Application
I am the developer of FreeMIS - an Open Source management information system for schools. It currently holds the data for one school - so different schools host different instances of FreeMIS. I would like to expand the domain of a single instance of FreeMIS, so that it covers all the schools in an education authority. THis will enable me to implement authority-wide functionality. Is there a standard pattern for this kind of extension? As I see it, everything that is in the database will need also to belong to a school, and when someone logs in they will only see the data relevant to their school (unless they are education authority managers who will have their own interface). Any advice on how to implement this in the DRYest, most Rails-esque way will be most gratefully received :) Robert Jones -- Posted via http://www.ruby-forum.com/.
Michael Glaesemann
2006-Jul-01 14:34 UTC
[Rails] Seeking Advice on Pattern for Multi-Organization Application
On Jul 1, 2006, at 18:25 , Robert Jones wrote:> I would like to expand the domain of a single instance of FreeMIS, so > that it covers all the schools in an education authority. THis will > enable me to implement authority-wide functionality.Sounds like what you want is an Authority model that has_many :schools. I don''t think you want a separate database for each school. Michael Glaesemann grzm seespotcode net
Ezra Zygmuntowicz
2006-Jul-01 18:17 UTC
[Rails] Seeking Advice on Pattern for Multi-Organization Application
On Jul 1, 2006, at 2:25 AM, Robert Jones wrote:> I am the developer of FreeMIS - an Open Source management information > system for schools. It currently holds the data for one school - so > different schools host different instances of FreeMIS. > > I would like to expand the domain of a single instance of FreeMIS, so > that it covers all the schools in an education authority. THis will > enable me to implement authority-wide functionality. > > Is there a standard pattern for this kind of extension? As I see it, > everything that is in the database will need also to belong to a > school, > and when someone logs in they will only see the data relevant to their > school (unless they are education authority managers who will have > their > own interface). > > Any advice on how to implement this in the DRYest, most Rails-esque > way > will be most gratefully received :) > > Robert Jones > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/railsYou should have a look at the acount_location plugin. Its built for this situation. It allows you to have accounts keyed off of subdomains. like foo.example.com and bar.example.com. This way you have an Account model and you use a before filter on every request that takes the subdomain and finds the account that matches that subdomain. Then you scope your queries to the account model. -Ezra
Daniel N
2006-Jul-02 01:30 UTC
[Rails] Seeking Advice on Pattern for Multi-Organization Application
On 7/2/06, Ezra Zygmuntowicz <ezmobius@gmail.com> wrote:> > > On Jul 1, 2006, at 2:25 AM, Robert Jones wrote: > > > I am the developer of FreeMIS - an Open Source management information > > system for schools. It currently holds the data for one school - so > > different schools host different instances of FreeMIS. > > > > I would like to expand the domain of a single instance of FreeMIS, so > > that it covers all the schools in an education authority. THis will > > enable me to implement authority-wide functionality. > > > > Is there a standard pattern for this kind of extension? As I see it, > > everything that is in the database will need also to belong to a > > school, > > and when someone logs in they will only see the data relevant to their > > school (unless they are education authority managers who will have > > their > > own interface). > > > > Any advice on how to implement this in the DRYest, most Rails-esque > > way > > will be most gratefully received :) > > > > Robert Jones > > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > You should have a look at the acount_location plugin. Its built for > this situation. It allows you to have accounts keyed off of > subdomains. like foo.example.com and bar.example.com. This way you > have an Account model and you use a before filter on every request > that takes the subdomain and finds the account that matches that > subdomain. Then you scope your queries to the account model. > > > -Ezra > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/railsWith the account_location plugin, does it automatically setup the required DNS entries? Or does an app need to look after this itself? \ This is a very weak point for me, and has basically stopped me from looking at it too closely. Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060702/75425b7e/attachment.html
Ezra Zygmuntowicz
2006-Jul-02 01:43 UTC
[Rails] Seeking Advice on Pattern for Multi-Organization Application
On Jul 1, 2006, at 6:30 PM, Daniel N wrote:> > > On 7/2/06, Ezra Zygmuntowicz <ezmobius@gmail.com> wrote: > > On Jul 1, 2006, at 2:25 AM, Robert Jones wrote: > > > I am the developer of FreeMIS - an Open Source management > information > > system for schools. It currently holds the data for one school - so > > different schools host different instances of FreeMIS. > > > > I would like to expand the domain of a single instance of > FreeMIS, so > > that it covers all the schools in an education authority. THis will > > enable me to implement authority-wide functionality. > > > > Is there a standard pattern for this kind of extension? As I see > it, > > everything that is in the database will need also to belong to a > > school, > > and when someone logs in they will only see the data relevant to > their > > school (unless they are education authority managers who will have > > their > > own interface). > > > > Any advice on how to implement this in the DRYest, most Rails-esque > > way > > will be most gratefully received :) > > > > Robert Jones > > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > You should have a look at the acount_location plugin. Its built for > this situation. It allows you to have accounts keyed off of > subdomains. like foo.example.com and bar.example.com. This way you > have an Account model and you use a before filter on every request > that takes the subdomain and finds the account that matches that > subdomain. Then you scope your queries to the account model. > > > -Ezra > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > With the account_location plugin, does it automatically setup the > required DNS entries? Or does an app need to look after this > itself? \ > This is a very weak point for me, and has basically stopped me from > looking at it too closely. > > DanDan- Yeah you have to set up a wildcard dns entry for your domain in order to use this in production. But you can set up aliases in /etc/ hosts for when you are developing locally. for local stuff ad a line like this to your /etc/hosts file: 127.0.0.1 advisrdev.org ezmobius.advisrdev.org demo.advisrdev.org That gives me a few subdomains and a main domain to work with locally. -Ezra -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060702/0af5d140/attachment.html
Daniel N
2006-Jul-02 01:53 UTC
[Rails] Seeking Advice on Pattern for Multi-Organization Application
On 7/2/06, Ezra Zygmuntowicz <ezmobius@gmail.com> wrote:> > > On Jul 1, 2006, at 6:30 PM, Daniel N wrote: > > > > On 7/2/06, Ezra Zygmuntowicz <ezmobius@gmail.com> wrote: > > > > > > On Jul 1, 2006, at 2:25 AM, Robert Jones wrote: > > > > > I am the developer of FreeMIS - an Open Source management information > > > system for schools. It currently holds the data for one school - so > > > different schools host different instances of FreeMIS. > > > > > > I would like to expand the domain of a single instance of FreeMIS, so > > > that it covers all the schools in an education authority. THis will > > > enable me to implement authority-wide functionality. > > > > > > Is there a standard pattern for this kind of extension? As I see it, > > > everything that is in the database will need also to belong to a > > > school, > > > and when someone logs in they will only see the data relevant to their > > > > > school (unless they are education authority managers who will have > > > their > > > own interface). > > > > > > Any advice on how to implement this in the DRYest, most Rails-esque > > > way > > > will be most gratefully received :) > > > > > > Robert Jones > > > > > > -- > > > Posted via http://www.ruby-forum.com/. > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > You should have a look at the acount_location plugin. Its built for > > this situation. It allows you to have accounts keyed off of > > subdomains. like foo.example.com and bar.example.com. This way you > > have an Account model and you use a before filter on every request > > that takes the subdomain and finds the account that matches that > > subdomain. Then you scope your queries to the account model. > > > > > > -Ezra > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > With the account_location plugin, does it automatically setup the required > DNS entries? Or does an app need to look after this itself? \ > This is a very weak point for me, and has basically stopped me from > looking at it too closely. > > Dan > > > > Dan- > > Yeah you have to set up a wildcard dns entry for your domain in order to > use this in production. But you can set up aliases in /etc/hosts for when > you are developing locally. > > for local stuff ad a line like this to your /etc/hosts file: > > 127.0.0.1 advisrdev.org ezmobius.advisrdev.org demo.advisrdev.org > > That gives me a few subdomains and a main domain to work with locally. > > -Ezra >Thanx for the response, but I''m afraid I''m a bit thick with this stuff. I can see what you''ve done in the /etc/hosts file wrt local requests, is it enough to add to the hosts file on the server in a live app for external users to have their browsers do the right thing or does it need to update a dns server? Basecamp seems to have their accounts available on subdomains immediatley when you sign up so I don''t imagine that they have to propergate this change though the net DNS system. Is there anywhere that gives a fairly in-depth explaination or tutorial that''s not quite as dry as a DNS spec? Cheers Dan Thanx for any help _______________________________________________> 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/20060702/19d90b52/attachment-0001.html
Ezra Zygmuntowicz
2006-Jul-02 02:36 UTC
[Rails] Seeking Advice on Pattern for Multi-Organization Application
On Jul 1, 2006, at 6:53 PM, Daniel N wrote:> > > On 7/2/06, Ezra Zygmuntowicz <ezmobius@gmail.com> wrote: > > On Jul 1, 2006, at 6:30 PM, Daniel N wrote: > >> >> >> On 7/2/06, Ezra Zygmuntowicz <ezmobius@gmail.com> wrote: >> >> On Jul 1, 2006, at 2:25 AM, Robert Jones wrote: >> >> > I am the developer of FreeMIS - an Open Source management >> information >> > system for schools. It currently holds the data for one school >> - so >> > different schools host different instances of FreeMIS. >> > >> > I would like to expand the domain of a single instance of >> FreeMIS, so >> > that it covers all the schools in an education authority. THis >> will >> > enable me to implement authority-wide functionality. >> > >> > Is there a standard pattern for this kind of extension? As I >> see it, >> > everything that is in the database will need also to belong to a >> > school, >> > and when someone logs in they will only see the data relevant to >> their >> > school (unless they are education authority managers who will have >> > their >> > own interface). >> > >> > Any advice on how to implement this in the DRYest, most Rails-esque >> > way >> > will be most gratefully received :) >> > >> > Robert Jones >> > >> > -- >> > Posted via http://www.ruby-forum.com/. >> > _______________________________________________ >> > Rails mailing list >> > Rails@lists.rubyonrails.org >> > http://lists.rubyonrails.org/mailman/listinfo/rails >> >> You should have a look at the acount_location plugin. Its built for >> this situation. It allows you to have accounts keyed off of >> subdomains. like foo.example.com and bar.example.com. This way you >> have an Account model and you use a before filter on every request >> that takes the subdomain and finds the account that matches that >> subdomain. Then you scope your queries to the account model. >> >> >> -Ezra >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> With the account_location plugin, does it automatically setup the >> required DNS entries? Or does an app need to look after this >> itself? \ >> This is a very weak point for me, and has basically stopped me >> from looking at it too closely. >> >> Dan > > > Dan- > > Yeah you have to set up a wildcard dns entry for your domain in > order to use this in production. But you can set up aliases in /etc/ > hosts for when you are developing locally. > > for local stuff ad a line like this to your /etc/hosts file: > > 127.0.0.1 advisrdev.org ezmobius.advisrdev.org > demo.advisrdev.org > > That gives me a few subdomains and a main domain to work with locally. > > -Ezra > > Thanx for the response, but I''m afraid I''m a bit thick with this > stuff. I can see what you''ve done in the /etc/hosts file wrt local > requests, is it enough to add to the hosts file on the server in a > live app for external users to have their browsers do the right > thing or does it need to update a dns server? > > Basecamp seems to have their accounts available on subdomains > immediatley when you sign up so I don''t imagine that they have to > propergate this change though the net DNS system. > > Is there anywhere that gives a fairly in-depth explaination or > tutorial that''s not quite as dry as a DNS spec? > > Cheers > Dan > > Thanx for any helpDan- Yeah you need to set up what''s called a wildcard dns A record. This looks like *.mydomain.com. What dns server are you using? Here is a nice tutorial for bind, not rails specific but it should help anyway. http://photomatt.net/2003/10/10/wildcard-dns-and-sub-domains/ -Ezra -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060702/6d94aa7d/attachment.html
Robert Jones
2006-Jul-03 08:09 UTC
[Rails] Re: Seeking Advice on Pattern for Multi-Organization Applica
Ezra Zygmuntowicz wrote:> On Jul 1, 2006, at 2:25 AM, Robert Jones wrote: > >> school, >> >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > You should have a look at the acount_location plugin. Its built for > this situation. It allows you to have accounts keyed off of > subdomains. like foo.example.com and bar.example.com. This way you > have an Account model and you use a before filter on every request > that takes the subdomain and finds the account that matches that > subdomain. Then you scope your queries to the account model. > > > -EzraThanks for this (and for the other advice by other people) - this looks like just what I need. The scoping of my queries to the account model is going to take a while, but I know where I''m heading now. Cheers, Robert Jones -- Posted via http://www.ruby-forum.com/.
Daniel N
2006-Jul-05 12:36 UTC
[Rails] Seeking Advice on Pattern for Multi-Organization Application
On 7/2/06, Ezra Zygmuntowicz <ezmobius@gmail.com> wrote:> > > On Jul 1, 2006, at 6:53 PM, Daniel N wrote: > > > > On 7/2/06, Ezra Zygmuntowicz <ezmobius@gmail.com> wrote: > > > > > > On Jul 1, 2006, at 6:30 PM, Daniel N wrote: > > > > > > > > On 7/2/06, Ezra Zygmuntowicz <ezmobius@gmail.com> wrote: > > > > > > > > > On Jul 1, 2006, at 2:25 AM, Robert Jones wrote: > > > > > > > I am the developer of FreeMIS - an Open Source management > > > information > > > > system for schools. It currently holds the data for one school - so > > > > different schools host different instances of FreeMIS. > > > > > > > > I would like to expand the domain of a single instance of FreeMIS, > > > so > > > > that it covers all the schools in an education authority. THis will > > > > enable me to implement authority-wide functionality. > > > > > > > > Is there a standard pattern for this kind of extension? As I see > > > it, > > > > everything that is in the database will need also to belong to a > > > > school, > > > > and when someone logs in they will only see the data relevant to > > > their > > > > school (unless they are education authority managers who will have > > > > their > > > > own interface). > > > > > > > > Any advice on how to implement this in the DRYest, most Rails-esque > > > > way > > > > will be most gratefully received :) > > > > > > > > Robert Jones > > > > > > > > -- > > > > Posted via http://www.ruby-forum.com/. > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > You should have a look at the acount_location plugin. Its built for > > > this situation. It allows you to have accounts keyed off of > > > subdomains. like foo.example.com and bar.example.com. This way you > > > have an Account model and you use a before filter on every request > > > that takes the subdomain and finds the account that matches that > > > subdomain. Then you scope your queries to the account model. > > > > > > > > > -Ezra > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > With the account_location plugin, does it automatically setup the > > required DNS entries? Or does an app need to look after this itself? \ > > This is a very weak point for me, and has basically stopped me from > > looking at it too closely. > > > > Dan > > > > > > > > Dan- > > > > Yeah you have to set up a wildcard dns entry for your domain in order to > > use this in production. But you can set up aliases in /etc/hosts for when > > you are developing locally. > > > > for local stuff ad a line like this to your /etc/hosts file: > > > > 127.0.0.1 advisrdev.org ezmobius.advisrdev.org demo.advisrdev.org > > > > That gives me a few subdomains and a main domain to work with locally. > > > > -Ezra > > > > Thanx for the response, but I''m afraid I''m a bit thick with this stuff. I > can see what you''ve done in the /etc/hosts file wrt local requests, is it > enough to add to the hosts file on the server in a live app for external > users to have their browsers do the right thing or does it need to update a > dns server? > > Basecamp seems to have their accounts available on subdomains immediatley > when you sign up so I don''t imagine that they have to propergate this change > though the net DNS system. > > Is there anywhere that gives a fairly in-depth explaination or tutorial > that''s not quite as dry as a DNS spec? > > Cheers > Dan > > Thanx for any help > > > Dan- > > Yeah you need to set up what''s called a wildcard dns A record. This looks > like *.mydomain.com. What dns server are you using? Here is a nice tutorial > for bind, not rails specific but it should help anyway. > > http://photomatt.net/2003/10/10/wildcard-dns-and-sub-domains/ > > > -Ezra >Ezra, Thanx for the pointer. Being on windows it took me a while to get it going... Eventually got it with the treewalk dns server. Cheers Dan _______________________________________________> 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/20060705/b662adaa/attachment-0001.html