validates_uniqueness_of :number by the year in a DateTime column

Hello all,

I have a class Ticket < ActiveRecord::Base which has a property called
:number and a property called :samples_date.

a ticket number has to be unique over the same year. the year is given
by the property called :samples_date

I'm trying to validate the uniqueness of :number based on the year from
the :samples_date property.

i would like to specify the condition somehow in the :scope of the
validates_uniqueness_of :number but i dont know how.

Is there a way to restrict the validation of :number by the year from
the samples_date column table?