[Rails] JOIN

paulo@explicadores.net
2006-01-13T00:51:32Z

Hi!

For the following example I want to retrieve the last 10 LastEntries for
experis_date >= now.

class User < ActiveRecord::Base
  has_one :last_entries
  def self.last_entry_items
    find(:all,
#    :include => "last_entries",
#    :conditions => "last_entries.expires_date >= now()",
    :order => "id desc",
    :limit => 10)
  end
end

class LastEntrie < ActiveRecord::Base
	belongs_to :user
end

Rails tells me the following:

Mysql::Error: #42S02Unknown table ''last_entries'' in where
clause: SELECT * FROM
users WHERE (last_entries.expires_date >= now())  ORDER BY id desc  LIMIT 10

I was expecting to see here an inner join or something. Then I tried using
:include and rails gave the following error:

uninitialized constant LastEntries

I would apreciate any tip on this subject.

Thanks for you attention,

Paulo Abreu