The way I architect such Apps is by using centralized scope based 
authorization. It keeps the App clean and avoid bugs like dev forgot to 
scope the records in controller - controller can ONLY operate on records 
that are permitted for the current user. If somebody tries to access 
resource outside of what they are permitted, :not_found is returned rather 
than :unauthorized - works well for security and user experience. 

It has worked well for most of my Apps including complex ERP solutions. 
Based on project requirements, you may want to use independent schemas 
(pg), though it might be overkill in lot of use cases.

On Tuesday, March 14, 2017 at 5:21:03 AM UTC+5:30, Walter Lee Davis wrote:
>
> There are a number of different ways you can manage this. One popular 
> approach is to use the Apartment gem to create what is known as the 
> "multi-tenant" database pattern. See if that term gets you closer to what 
> your are looking for. 
>
> One database (or at least one schema) per site is the usual method, so 
> maybe say a little more about why you feel that you need to have the same 
> database for multiple sites. What makes these sites special, or what makes 
> the number of databases constrained? 
>
> Walter 
>
> > On Mar 13, 2017, at 6:30 PM, fugee ohu <fuge...@gmail.com <javascript:>> 
> wrote: 
> > 
> > i have the idea to use the same database for multiple sites but i guess 
> each site needs it's own database in addition? Anyone  can guide me? 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Ruby on Rails: Talk" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to rubyonrails-ta...@googlegroups.com <javascript:>. 
> > To post to this group, send email to rubyonra...@googlegroups.com 
> <javascript:>. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/54a73f7c-f8c5-4474-92b5-80a4ca884146%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1fdc807b-00a6-44a3-9d81-157a6c6cf5f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to