I have two action in the same controller: def list if logged_in? sort = case params[''sort''] when "title" then "title" when "a" then "a" when "b" then "b" when "c" then "c" when "title_reverse" then "title DESC" when "a_reverse" then "a DESC" when "b_reverse" then "b DESC" when "c_reverse" then "c DESC" end if params[:query]==nil conditions = ["login LIKE ?", "%#{current_user.login}%"] else conditions = ["login LIKE ? and title LIKE ?", "%#{current_user.login}%","%#{params[:query]}%"] end @total = Suma.count(:conditions => conditions) @sumas = Suma.paginate :all, :order => sort, :conditions => conditions, :per_page => @total+1, :page => 1 if request.xml_http_request? render :partial => "items_list", :layout => false end else redirect_back_or_default(''/'') end end And I have other action : def xls # # Creamos un nuevo archivo Excel en disco # workbook = Excel.new("#{RAILS_ROOT}/public/works.xls") # # Añadimos hoja EMPRESAS # works = workbook.add_worksheet("Works") # # Fila de cabecera # @cabecera = %w(title a b c) # columna = 0 # @cabecera.each do |cab| # works.write(0,columna,cab) # columna += 1 # end # # Una fila para cada empresa # @sumas = Suma.find(:all, :conditions => ["login ?",current_user.login]) fila = 1 # for e in @sumas # # Añado la fila con los datos en sus respectivas columnas # works.write(fila,0,e.title) # works.write(fila,1,e.a) # works.write(fila,2,e.b) # works.write(fila,3,e.c) # Pasamos a la siguiente empresa en una nueva fila # fila += 1 # end I like when the user puss xls import the @sumas select in the list not all. Well pass list: @sumas to xls action!! Thank you!! -- Posted via http://www.ruby-forum.com/.