Bob Sanders
2008-Mar-29 22:54 UTC
Filtering out XML results ----- /people.xml?title=Manager
I''m using RESTful Rails, and I''m not sure how to filter out the XML sheet by title. I thought you could simply type in something like this: /people.xml?title=CEO, but it''s not filtering for me. What would I have to do to be able to filter out the results correctly? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Danimal
2008-Mar-30 01:05 UTC
Re: Filtering out XML results ----- /people.xml?title=Manager
Bob,
I haven''t actually used XML with Rails, but by my understanding,
calling:
/people.xml?title=CEO
is technically no different than calling:
/people?title=CEO
It just gives you the option to handle it via XML because of the
respond_to. You still have to process the parameters, i.e. in the
PeoplesController class for the "index" action, you might simply have:
def index
@people = Person.find_all_by_title(params[:title])
respond_to do |format|
format.html
format.xml { render :xml => @people }
end
end
You could probably get fancy with some metaprogramming but that might
be more than necessary.
HTH!
-Danimal
On Mar 29, 4:54 pm, Bob Sanders
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> I''m using RESTful Rails, and I''m not sure how to filter
out the XML
> sheet by title.
>
> I thought you could simply type in something like this:
> /people.xml?title=CEO, but it''s not filtering for me.
>
> What would I have to do to be able to filter out the results correctly?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---
Bob Sanders
2008-Mar-30 03:24 UTC
Re: Filtering out XML results ----- /people.xml?title=Manage
Danimal, you made it a million times more clearer. Thank you so much for the great explanation. I really appreciate it! :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---