On 11 November 2010 21:53, Ich <[email protected]> wrote: > I have these sql code in postgresql > "SELECT * from convenios where id NOT IN > (SELECT convenio_id from solicituds where usuario_id=?"
That does not look like valid sql to me. Can you explain in words what you are trying to achieve? I find this is often the best way of working out how to code something. Colin > > but don't find a way of used it in rails > except > find_by_sql. > > There is a another way?? > > class Usuario < ActiveRecord::Base > belongs_to :persona > has_many :solicituds, :dependent => :destroy > has_many :convenios, :through => :solicituds > has_many :nivelesacceso > has_one :nomina > end > > class Convenio < ActiveRecord::Base > has_many :solicituds, :dependent => :destroy > has_many :personas, :through => :solicituds > validates_presence_of :nombre, :serie, :descripcion > validates_uniqueness_of :serie > validates_format_of :serie, :with => /cci|cue/ > validates_length_of :serie, :is => 8 > end > > class Solicitud < ActiveRecord::Base > belongs_to :convenio > belongs_to :usuario > end > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

