Question: I want to display different types of objects in the same ajax called controller function. I want to render out when I send back an ajax call. The problem is I want the "title" attribute of one object and the "name" attribute of another object. I can't render 2 partials and can seem to figure out how to check the type of object an object is. How do I solve this problem?

Here is my current controller setup (NOT CORRECT)

```
@objects =  Obj.find(:all,:conditions => ["name Like ?", "#{prefix}%"])
@moreObjects = ObjTwo.find(:all,:conditions => ["title Like ?","#{prefix}%"])

if @objects.empty?
  render :text => "No Matches"
else
  render :partial => 'one', :collection => @objects
end

if  @moreObjects.empty?
  render :text => "No Matches"
else
  render :partial => 'two', :collection => @moreObjects
end

```

Answer: 
try something like

```
<%= obj.title if obj.respond_to?(:title) %>

```
You could use [Object.is\_a?](http://apidock.com/ruby/Object/is_a%3F) but that's not a very clean solution. You could also try mapping your data before presentation to help keep your views lightweight.