CRUD or not CRUD, I am so lost!

Does it mean that I am going to have one controller per model ? Having
one model for all relations is going to be lot of files, adding one
controller per model is just going to be way too much. As it was asked
earlier, is the CRUD philosophy really worth all the files it generates?

What’s the perceived price of many files? To me, it’s much simpler to
deal with 5 files that each have 5 methods than 2 files that each has
12. Also, you don’t need one model per relationship, if you’re thinking
that a relationship is an association. Only for many-to-many
relationships. So an Authorship model to link Author and Book, but no
model to link Post has_many :comments.

On 9/5/06, DHH [email protected] wrote:

relationships. So an Authorship model to link Author and Book, but no
model to link Post has_many :comments.

My one beef with completely-CRUD is that in one of my more involved
Rails applications I have several callpaths that end up requiring an
Update on a particular model, but from different view contexts (and so
a PUT /foos/1 on the corresponding model controller, a few times, each
time from a different view structure). My beef is with the fact that
ActionPack in its current form tightly couples action and view, and
while respond_to handles the content-type split well, it still doesn’t
allow me to cleanly separate out views for a particular action, such
as Update in my example. The best solution I could find here is Bruce
Williams’ context plugin
(http://codefluency.com/articles/2006/07/01/rails-views-getting-in-context/),
to further decouple view from action where absolutely necessary (note
that this is often required for applications where you have one main
callpath for a particular entity update, but a second completely
different one from, e.g., a streamlined wizard widget in your app).

Will context, in its current or similar form, ever end up in core?


Bosko M. [email protected]
http://www.crowdedweb.com/