Jeremy McAnally said the following on 04/01/08 10:44 AM:
You can add custom methods to a REST controller, and any custom method
is usually GET unless it’s destructive (POST) or edits a resource
(PUT).
OK, so back to my wiki. The ‘edit’ is the only thing there, nothing
destructive.
REST allows you to have a conventional layout to your controllers,
You don’t mean ‘/views/layouts’? So what does ‘conventional’ mean in
this context? (more below)
expose web services easily,
What if I don’t HAVE them? Why bother?
get nice named routes in Rails (including for your custom methods),
Let me try again: I don’t WANT what I’ve seen as nicely named routes
I don’t WANT URLs like
http://example.com/web/Webname/topic/TopicName
or ‘id’ instead of ‘name’
As I said, apart from out-of-ban things like login its just
http://example.com/Webname/TopicName[?params]
and because of its conventional layout, you
can abstract it very easily (e.g., make_resourceful reduces the CRUD
portion of your controllers to 4 lines rather than 100).
But I don’t see what I’m trying to address as ‘conventional CRUD’.
As I said at the beginning, I understand RESTfulnesss for that
invoice-item type, CRUD type applications, but there are a lot of web
based things that don’t follow that model. Wikis and games being a few.
If you’re concerned about your URLs, then customize the routing.
I am. And its very simple. Just one line. (see above)
There’s nothing saying you can’t have routing aliases for browser
clients of your RESTful actions so long as the RESTful one is still
available for web services.
Amos K. suggested what seems to be mapping each method onto a
controller. That doesn’t make sense to me either.
I can understand a Search Controller in the context of a page with a
form for the search parameters then submitted to that controller, but
its still drawing on the basic wiki functionality for rendering, so why
bother.
If a search is embedded in a page (see TWiki, Xwiki, MoinMoin and many
other wikis) then I can’t see it being a web service instead of a
library utility. The Search Page calls this library too. So why bother
with the controller to move the code out of the WikiController?
If I have a search controller to move the search code out of the
WikiController (where it wasn’t in the first place 'cos it was in a
library) the its only going to have one method.
So why, reductio ad absurdem, don’t I convert everything that is a
method in the WikiController into a controller with one method, get rid
of the WikiController and do everything from
‘app/controllers/Application.rb’ ?
Let me ask all this another way.
I’ve asked this before in another wording and got no reply.
The user tries to ‘view’ a page. The WikiController’s ‘view’ method
gets to the point where it finds the topic and checks accessibility.
Right now if a login is required to view that page it does a redirect
with return-to to the login page. Its irrelevant whether the login
mechanism is RESTful or not. I’ve installed ‘restful authentication’
and its happy with the redirect & return-to, as was the old acts_as …
with no RESTful-ness. So what’s the benefit?
Please don’t say ‘extending functionality’. I pasted in code to do p/w
change into both versions of the authenticator with ease.
Can I do some magic pop-up with ‘restful authentication’ that I couldn’t
with the old version? I’ve asked about that as well and again got no
reply. Wouldn’t a popup authenticator be a ‘web service’ of some kind?
–
“I think there is a world market for about five computers.”
Thomas J. Watson, chairman of the board of IBM, 1943