On Sep 19, 2006, at 11:40 AM, Ryan Walker wrote:> I''ve read most of the Ruby/Rails books, but I''m
struggling with
> this: How do you combine simple AJAX UI actions with RESTful  
> controllers?
>
> In my app, I want to keep all controllers REST-compliant. On a  
> form, I want one select dropdown filter the options in another  
> select. So I read several ajax ways I can do that. But they all  
> seem to point to hitting an action on the controller, which would  
> be outside of REST (the action wouldn''t be INDEX, NEW, CREATE,  
> SHOW, EDIT, UPDATE, DESTROY). I see in the e-book RJS Templates for  
> Rails how to build RJS-based site, but is an Ajaxed-out site just  
> going to have controllers with more than 7 actions, or am I missing  
> something?
I''m guessing you want an action that will return a list of items for  
the second dropdown? If so, you should be able to pass a query string  
to your index action to filter the results it returns.
eg. a GET to /controller/?month=september
would restrict the list that the index returns to only results in  
september. That seems pretty RESTful to me -- it''s using appropriate  
HTTP methods to request a list of resources with some simple  
filtering based on the query string.
Your index.rjs can then work with that data.
James.
-- 
James Stewart : Freelance Web Developer
Work : http://jystewart.net
Play : http://james.anthropiccollective.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---