# Filtering out XML results ----- /people.xml?title=Manager

**URL:** <https://www.ruby-forum.com/t/filtering-out-xml-results-people-xml-title-manager/133312>\
**Category:** Rails\
**Created:** [March 29, 2008, 11:54pm UTC](https://www.ruby-forum.com/t/filtering-out-xml-results-people-xml-title-manager/133312 "2008-03-29T23:54:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [March 29, 2008, 11:54pm UTC](https://www.ruby-forum.com/t/filtering-out-xml-results-people-xml-title-manager/133312/1 "2008-03-29T23:54:11Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [March 30, 2008, 3:05am UTC](https://www.ruby-forum.com/t/filtering-out-xml-results-people-xml-title-manager/133312/2 "2008-03-30T03:05:40Z")

</div>

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 S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [March 30, 2008, 3:24am UTC](https://www.ruby-forum.com/t/filtering-out-xml-results-people-xml-title-manager/133312/3 "2008-03-30T03:24:45Z")

</div>

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