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?

On Wednesday 14 March 2007, Fluffy Hippo wrote:

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


Michael S.
mailto:[email protected]
http://www.schuerig.de/michael/

On Mar 14, 9:01 am, “Fluffy Hippo” [email protected] wrote:

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?

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs