BraveDave
2007-Mar-21 23:30 UTC
How does Basecamp ''scope'' distinct users in a monolithic database?
I''m hoping to find someone who realizes the implications of this
design strategy. I am attempting to build an application that access a
common monolithic database but each user has a ''scope'' so they
only
see their data..
My strategy is to create an http request that looks like
project.controller.action.keyvalue and pass this throughout the
application. The "Project" term is used to describe a distinct data
scope that one user or a group would maintain.
I expect we''d make http calls like http:\
\project.controller.action.keyvalue and database calls like:
link_to: #{table.row.columname}
:Project => project
:Controller=>controller
:Action=> action
:Id => id
The patriarch of all RonR programs written by DHH (Basecamp) must
utilize a strategy similar to this as they are running the same
generic program, but accessing distinct data from one monolithic
database.
When Basecamp passes an http: request it''s got to hold inside this
package the group database, user, controller, action and value. Does
anyone know the basic architecture of how this is accomplished?
I found one clue to this question today when looking at the the
ActionPack API and in it, DHH wrote:
Routing makes pretty urls incredibly easy
map.connect
''clients/:client_name/:project_name/:controller/:action''
Accessing /clients/37signals/basecamp/project/dash calls
ProjectController#dash with
{ "client_name" => "37signals",
"project_name" => "basecamp" } in
params[:params]
From that URL, you can rewrite the redirect in a number of ways:
redirect_to(:action => "edit") =>
/clients/37signals/basecamp/project/dash
redirect_to(:client_name => "nextangle", :project_name =>
"rails")
=>
/clients/nextangle/rails/project/dash
I am willing to pay for someone to teach me how this is done.
Thank you,
David
VirtualLifestyle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Krishna Dole
2007-Mar-21 23:55 UTC
Re: How does Basecamp ''scope'' distinct users in a monolithic database?
hi dave,
my apologies if i misunderstood your question, but if you''re asking
about the routing, you can set up a route like so:
map.connect ''projects/:project_id/:controller/:action/:id''
and when you use link_to, you only have to specify :project_id on the
link that takes them into the project; subsequently, omitted
:project_id and :controller default to the current one. so once in the
widget controller for project 42, you can make links like:
link_to @widget.name , :action => "show", :id => @widget
which will create a link to: /projects/42/widget/show/23
of course on each request you need to validate that the user is a
member of the project and that the data they are asking for belongs to
the project.
hope that helps,
krishna
On 3/21/07, BraveDave
<DauntlessDavid-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> I''m hoping to find someone who realizes the implications of this
> design strategy. I am attempting to build an application that access a
> common monolithic database but each user has a ''scope'' so
they only
> see their data..
> My strategy is to create an http request that looks like
> project.controller.action.keyvalue and pass this throughout the
> application. The "Project" term is used to describe a distinct
data
> scope that one user or a group would maintain.
> I expect we''d make http calls like http:\
> \project.controller.action.keyvalue and database calls like:
> link_to: #{table.row.columname}
> :Project => project
> :Controller=>controller
> :Action=> action
> :Id => id
>
> The patriarch of all RonR programs written by DHH (Basecamp) must
> utilize a strategy similar to this as they are running the same
> generic program, but accessing distinct data from one monolithic
> database.
> When Basecamp passes an http: request it''s got to hold inside this
> package the group database, user, controller, action and value. Does
> anyone know the basic architecture of how this is accomplished?
> I found one clue to this question today when looking at the the
> ActionPack API and in it, DHH wrote:
>
> Routing makes pretty urls incredibly easy
> map.connect
''clients/:client_name/:project_name/:controller/:action''
>
> Accessing /clients/37signals/basecamp/project/dash calls
> ProjectController#dash with
> { "client_name" => "37signals",
"project_name" => "basecamp" } in
> params[:params]
>
> From that URL, you can rewrite the redirect in a number of ways:
>
> redirect_to(:action => "edit") =>
> /clients/37signals/basecamp/project/dash
>
> redirect_to(:client_name => "nextangle", :project_name =>
"rails")
> =>
> /clients/nextangle/rails/project/dash
>
> I am willing to pay for someone to teach me how this is done.
>
> Thank you,
> David
> VirtualLifestyle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Benjamin Curtis
2007-Mar-22 16:13 UTC
Re: How does Basecamp ''scope'' distinct users in a monolithic database?
Take a look at this plugin for clues: http://agilewebdevelopment.com/ plugins/account_location -- Building an e-commerce site with Rails? http://agilewebdevelopment.com/rails-ecommerce Meet up at RailsConf: http://railsconf2007.conferencemeetup.com/ On Mar 21, 2007, at 4:30 PM, BraveDave wrote:> > I''m hoping to find someone who realizes the implications of this > design strategy. I am attempting to build an application that access a > common monolithic database but each user has a ''scope'' so they only > see their data.. > My strategy is to create an http request that looks like > project.controller.action.keyvalue and pass this throughout the > application. The "Project" term is used to describe a distinct data > scope that one user or a group would maintain. > I expect we''d make http calls like http:\ > \project.controller.action.keyvalue and database calls like: > link_to: #{table.row.columname} > :Project => project > :Controller=>controller > :Action=> action > :Id => id > > The patriarch of all RonR programs written by DHH (Basecamp) must > utilize a strategy similar to this as they are running the same > generic program, but accessing distinct data from one monolithic > database. > When Basecamp passes an http: request it''s got to hold inside this > package the group database, user, controller, action and value. Does > anyone know the basic architecture of how this is accomplished? > I found one clue to this question today when looking at the the > ActionPack API and in it, DHH wrote: > > Routing makes pretty urls incredibly easy > map.connect ''clients/:client_name/:project_name/:controller/:action'' > > Accessing /clients/37signals/basecamp/project/dash calls > ProjectController#dash with > { "client_name" => "37signals", "project_name" => "basecamp" } in > params[:params] > > From that URL, you can rewrite the redirect in a number of ways: > > redirect_to(:action => "edit") => > /clients/37signals/basecamp/project/dash > > redirect_to(:client_name => "nextangle", :project_name => "rails") > => > /clients/nextangle/rails/project/dash > > I am willing to pay for someone to teach me how this is done. > > Thank you, > David > VirtualLifestyle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---