Jason Roelofs said the following on 04/01/08 07:33 AM:
map.resources :topics, :collection => {:search => :get} ). In my
months of learning to do a more RESTful site, I've found out that
it's not about making a web-service-like website, but more of what
thinking RESTfully does to your design.
In short, RESTful web design is cleaner and much easier to
understand. It keeps your controllers small and the logic seperated
out. So instead of one massive WikiController, you'd have a
WikiController, TopicController, AccountController, etc, which is
much easier on: future developers of the product, people trying to
bookmark parts of the wiki, the webserver for not having to deal
with so much code at once, etc. It's just a good idea.
Give it a try, you'll see what I mean.
I have and I don't.
Obviously I "don't get it".
I've plugged "restful authentication" into my wiki and that's fine
because its compartmentalized, but the rest of the wiki works entirely
on urls of the form
http://hostname.com/Webname/TopicName
with an optional "/:action" - edit, history ... you know the rest
(sorry, I can't resists puns)
Intrinsically there ARE methods. Strictly speaking there isn't even
CRUD, since editing a previously non existent topic causes its creation
and you don't 'delete' a topic you 'rename' it to the waste-bin Web.
So there's WikiController and no TopicController or WebController. (Oh,
there was when experimenting and as an admin interface, but they are
long gone, their function wasn't relevant to the wiki interface.)
The authentication function is completely orthogonal to the Wiki space
so having '/login' and '/register' is not an issue.
You say "RESTful web design is cleaner and much easier to understand"
but I don't see that. So many people say that and its getting to sound
like a "fashion" and "proof by assertion". As I've said, there are blog
postings where people claim this simplification by don't show the 'how'
and don't show it in a way that I can learn from the process.
Now and in the past I'm thinking in terms of what the application looks
like to the user. Navigating the wiki, the wiki's functionality is one
thing and the 'login/registration' is a "popup" (if only I could get
popups to work the way I want) in the workflow (aka "You need to login
to access this topic" type popups). This has led me to think in terms
of the routing and the mapping of the actions, of which there are many
beyond CRUD.
So, even if I somehow REST-ificate the WikiController, how do I decide
what GET/PUT are 'history', 'alter metadata', 'diff r1=n, r2=m', rename,
'search', 'upload', 'view attachment' and so on.
Please, I'm seeking a methodology and approach. I'd love to have a
simpler WikiController. I'd love to have a UiController that handles
the commonality of access control, dealing with exceptions and so on
(right now its 'lib/ui_wrapper.rb) that 'view', 'edit' and so on are
parameters for (modules?). But what value of WebController or
TopicController? (All I can see for them is web services to give lists
for 'rename'.)
I'm sorry, Jason, without some explanation it all seems like "proof by
assertion" or "the latest fashion" to me.
I'm finding this very frustrating since I can't see how this is relevant
to me without a lot of jigging the routing, like you illustrate, Jason.
At which point I say "Why bother? How is this different from what I'm
doing now with all the methods?"