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?


I haven’t actually used XML with Rails, but by my understanding,


is technically no different than calling:


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.xml  { render :xml => @people }


You could probably get fancy with some metaprogramming but that might
be more than necessary.



On Mar 29, 4:54 pm, Bob S. [email protected]

Danimal, you made it a million times more clearer. Thank you so much for
the great explanation. I really appreciate it! :slight_smile:

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