class Foo < ActiveRecord::Base

  def title=(title)
    title.gsub!(/\D+/, '')
    attributes[:title] = title
  end

end