El problema de hacer esto:

class ClientMovement < ActiveRecord::Base
 def debit
   read_attribute(:debit).to_i
 end
end

es que si debit tiene que ser decimal te lo trunca, tal vez:

class ClientMovement < ActiveRecord::Base
 def debit
   read_attribute(:debit) || 0
 end
end


2010/2/23 Ricardo Markiewicz <[email protected]>

> > Es algo asi:
> > ClientesMovimientos
> >   ||
> >   ====>Solicitudes
> >                     ||
> >                     ===>Clientes
> > Asi que ruby me reto al hacer mas o menos como mi pequeña mente imagino
> que
> > estaba bien:
> > @clientes_movimientos = ClienteMovimiento.all(:joins => [:solicitud,
> > :cliente],
> >     :conditions => {"clientes.id" => params[:id] })
> > Y me dijo en ingles ¨Association named 'cliente' was not found; perhaps
> you
> > misspelled it?¨
>
> De [1] :
> 4.2.4 Joining Nested Associations (Multiple Level)
> Category.all :joins => {:posts => [{:comments => :guest}, :tags]}
>
> Por lo que podrias hacer algo como :
>   @clientes_movimientos = ClienteMovimiento.all(:joins => [{:solicitud
> => :cliente}],
>      :conditions =>  {"clientes.id" => params[:id] }) (o similar)
>
> En simples palabras (o mas bien letras) RTFM :).
>
> [1] http://guides.rubyonrails.org/active_record_querying.html
>
> --
> --
> Ricardo Markiewicz
> http://www.gazer.com.ar/
> http://www.voyovoy.com/ - ¿Qué hay para hacer?
> _______________________________________________
> Ruby mailing list
> [email protected]
> http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar
>



-- 
-------------------------------
Juan Matías Repetti
Web Developer
--------------------------------
_______________________________________________
Ruby mailing list
[email protected]
http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar

Responder a