Belongs_to and has_many

Hi all

I have a model called,article which belongs_to user
so in article.rb
belongs_to :user

and in user.rb
has_many :posts, :dependent => :nullify, :class_name => 'Article'

so now @user.posts is giving the posts of the user

Now like,without using any named_scope,
i would want @user.posts to give out only the posts which were published
before 10 days.

I know i can use a named_Scope
But i want to directly use @user.posts alone to get the above result.

Is it possible to do this??

Thanks In Advance,

Charanya

Is it possible to do this??

Look up "default_scope"

has_many :posts, :conditions => 'created_at >= #{10.days.ago}'

That'll return all posts that were created in the 10 days before the
application was started (because 10.days.ago is evaluated in the class
body). To return all posts that were created in the 10 days before the
query is run, you want:

has_many :posts, :conditions => proc { ['created_at >= ?', 10.days.ago] }

Mat