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