Combo Select Filter Data

*** controller **
def filtro
    if !params[:filtro][:campo].nil?
      tipo_filtro = params[:filtro][:campo]
        @inmobiliaria = Inmobiliaria.find(params[:id])
      proyecto = @inmobiliaria.proyectos_inmobiliarios.find(:all,
:conditions => ['tipo_propiedad_id = ?',tipo_filtro])
    end
    @proyectos = proyecto.paginate :page => params[:page], :per_page =>
10
    @numero_proyectos = proyecto.size
        render :partial => "resultado_inmobiliaria", :layout => false,
:object => @proyectos
  end

ups the error

You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]

try:

if params[:filtro] && !params[:filtro][:campo].nil?
...

or

if (params[:filtro][:campo] rescue false)

if there's no params[:filtro], the chained call to [:campo] will cause
that error.