Fearless Fool wrote:
> Marnen Laibow-Koser wrote:
>>> ...
>> No. The basic 7 REST actions are common, not gospel. There's nothing
>> wrong with making plot a custom REST action (route would be the same as
>> above, but on the same footing with domain/:domain_id/edit ).
>
> If I understand correctly, when you say "on the same footing with
> domain/:domain_id/edit", you are recommending adding new actions to
> DomainController beyond the RESTful seven,
Beyond the *common* RESTful 7. Again, those actions are common, but not
exhaustive.
> so we might have
> domain/:domain_id/plot or domain/:domain_id/report -- is this what you
> meant?
Yes.
>
>> And please: use shallow routes. There's probably no reason to have the
>> user_id in the domain path.
>
> In this (slightly contrived) example, specific domains belong to
> individual users, so the user/:user_id/domain/:domain_id seems
> appropriate. (If you disagree, take a look at
> http://www.ruby-forum.com/topic/208631 and let me know if I've been
> mis-informed... :)
Domains belong to users, but since the domain already knows whom it
belongs to, there's usually no reason to put that information in the
path and make longer URLs.
>
>>> 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?
>>
>> What do you mean here?
>
> The user can choose between viewing the data in tabular form or as a
> plot, but the .erb code that generates those are radically different.
(Aside: get into the habit of using Haml, not ERb.)
> I
> think @Sharagoz answered my question here: the controller can select a
> "table" template or a "plot" template accordingly. (That was news to
> me.)
It can, but usually if you want different view files, you probably have
things that should be different controller actions.
>
>>> And finally, would you back the controller with a Plot model? ...
>>
>> You don't have to have a model for each controller. You don't have to
>> have a controller for each model. You don't have to have a database
>> table for each model.
>
> Noted. @Sharagoz pointed that out as well.
>
> Thanks both!
>
> - ff
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
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.
No comments:
Post a Comment