REST and AJAX Validators

So what’s the ‘right’ way to deal with AJAXY validators under REST?

Say I have an observe_field that checks against taken usernames, where do I stick the available_user method? … it doesn’t seem to fit in the RESTful user_controller, do I just create another controller to store all my AJAX cruft that is non-REST, or is there a more official/sanctioned/opinionated way to do this?

So what's the 'right' way to deal with AJAXY validators under REST?

Put them in the controller that handles the resource.

Say I have an observe_field that checks against taken usernames,
where do I stick the available_user method? ... it doesn't seem to
fit in the RESTful user_controller,

REST is a guideline, not a straitjacket.

Michael

What would available_user do? My guess is, given a potential user
name, see if a user with than name already exists, right?

In that case, perhaps your ajax call would just call myapp.com/users?
name='potential_name' and see if you get a 404 back (no user found) or
a 200 (which could mean that the user was found).

This way you're still RESTful, just look for query parameters that
help refine your query.

Would that work?

Jeff
softiesonrails.com