pepe wrote:
Perd�n, deber�a haber dicho ‘cada “array” interno deber�a contener…’
Pepe
buen dia men gracias por tu interes se ve que tienes el conocimiento te
voy a colocar el codigo para que me puedas facilitar mejor tu
conocimiento.class Repuesto::RetmoveController < ApplicationController
layout ‘repuesto’
include Inserciones
def index
constantes()
@aa=@prbxx
session[:cond] =" "
@limit =5
@conditions = " "
@page = params[:page].blank? ? 0 : params[:page].to_i
#@cant = Re_tmtinv.find(:all, :conditions => @conditions).size
@from = @page == 0 ? 0 : @page*@limit
para hacer una consulta a una tabla en la BD Oracle
autosys_db = DBI.connect(‘dbi:ODBC:autosys’,‘repuesto’,‘repuesto’)
sql = autosys_db.prepare(“SELECT mtin_mtin,mtin_descri FROM re_tmtinv”)
sql.execute
ar_tmp = sql.fetch
autosys_db.disconnect
@all_retmove=ar_tmp
end
def paginar
@limit = 5
if !params[:retmove].blank?
condiciones()
session[:cond]=@conditions
else
@conditions = session[:cond]
end
@page = params[:page].blank? ? 0 : params[:page].to_i
#@cant = Retmtinv.find(:all, :conditions => @conditions).size
@from = @page == 0 ? 0 : @page*@limit
#@all_retmove = Retmtinv.find(:all, :conditions => @conditions,
:limit => “#{@from},#{@limit}”, :order => “id DESC”)
autosys_db = DBI.connect(‘dbi:ODBC:autosys’,‘repuesto’,‘repuesto’)
sql = autosys_db.prepare(“SELECT mtin_mtin,mtin_descri FROM
re_tmtinv where mtin_mtin = #’{mtin}and mtin_descri = #’{descri} '”)
sql.execute
ar_tmp = sql.fetch
autosys_db.disconnect
@all_retmove=ar_tmp
render(:partial => 'listretmove')
end
end
la vista es la siguiente
Repuestos Registrados
<% form_for :model, @model, :url => { :action => ‘action’ } do |c| %>
Repuestos |
Opciones |
<% @cont = 0 %>
<% @all_retmove.each do |c| %>
<% @cont += 1 %>
<% @cont % 2 == 0 ? @cl = "par" : @cl = "impar" %>
<%= c[1] %>
|
<td align="center" width="1%">
<%=
link_to(image_tag(“botones/modificar.gif”,:border=>0,:size=>‘20x20’,
:title => “Modificar”, :alt=>‘Modificar Seleccionados’),:controller =>
‘/repuesto/retmove’, :action => :modretmove, :mtin_mtin => c[0] ) %>
<%=
link_to_remote(image_tag(“botones/borrar2.gif”,:border=>0,:size=>‘20x20’,
:title => “Eliminar”, :alt=>‘Eliminar Seleccionados’),:url =>
{:controller => ‘/repuesto/retmove’, :action => :Delete, :mtin_mtin =>
c[0] }, :update => ‘renderSpace2’, :confirm=>‘Esta seguro de querer
eliminar este registro?’) %>
|
</tr>
<% end %>
<% if @page > 0 %>
<%= link_to_remote(image_tag("botones/anterior2.gif",
:Size=>'30x30', :border=>0, :title=>'Anterior'), :update =>
'renderSpace2', :url => {:controller => '/repuesto/retmove', :action =>
:Paginar}, :with => "'page='+ #{@page-1}")%>
<% end %>
<%= link_to_remote(image_tag("botones/siguiente2.gif", :Size=>'30x30',
:border=>0, :title=>'Siguiente'), :update => 'renderSpace2', :url =>
{:controller => '/repuesto/retmove', :action => :Paginar}, :with =>
"'page='+ #{@page+1}")%>
<% end %>
###############################################################################
ok como bien podras visualizar tengo el siguiente problema no me esta
generando la informacion que yo requiero solo me muestra un 80 y 88
cuando yo en realidad necesito que me muestre el codigo y la descripcion
del repuesto,que sugieres en este caso.