I will do something like this
class Attachment < ActiveRecord::Base
belongs_to :user
has_attached_file :image
end
class User < ActiveRecord::Base
belongs_to :current_attachment, class_name: 'Attachment'
has_many :attachments, order: 'attachments.created_at ASC'
end
and in the controller that processes the image loading after successfully creating a new attachment entry, replace the existing user_current_attachment with the newly created one.
, counter_cache , , before_create .