Monday, April 26, 2010

[Rails] RESTful style: multiple plot styles, query strings

In my quest to practice good style, I'm a bit stumped on the following.

Assume an app that lets a user visualize recent web activity on various
domains ("user has many domains"). In ordinary RESTful style, the path
/user/:user_id/domain invokes 'index' and lists all the domains, the
path /user/:user_id/domain/:domain_id shows particulars about one
domain.

Our app needs a 'display graph' button on the 'show' page to plot
historical activity for a particular domain. The plot page has lots of
options (set time scale, filter different kinds of packets, etc), and I
can imagine these being tacked onto a path as query strings.

I'm a bit stumped as to how this really fits into RESTful style. Would
you create a Plot controller ("domain has one plot") and control it with
a path like /user/:user_id/domain/:domain_id/plot?plotoptions... ?

Also, the app calls for radically different page layouts depending on
selected display style (e.g. plot vs table view) -- can one controller
invoke multiple views? Or must you create one controller per view?

And finally, would you back the controller with a Plot model? Except
for caching complex plots, I don't see a real motivation for db
persistence, unless, of course, the Rails framework really wants a Plot
model to go with a Plot controller.

I welcome your insights...

- ff
--
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@googlegroups.com.
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate