You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: achievement.rb
    path of file: ./repos/qaror/app/models
    
    the code of the file until where you have to start completion: class Achievement < ActiveRecord::Base

  belongs_to :trigger, :foreign_key => :trigger_id, :class_name => "Activity"
  belongs_to :activity
  belongs_to :tag
  belongs_to :user
  belongs_to :badge, :counter_cache => "achieved_count"

  attr_reader :name
  attr_p
    
  def self.find_or_create(*args)
    return false unless APP_CONFIG['gain_achievements']

    name = args[0]
    user = args[1][:user]
    activity = args[1][:activity]
    uniq_activityable = args[1][:uniq_activityable]
    activityable = args[1][:activityable]

    badge = Badge.find_by_name!(name)

    if activity && user && uniq_activityable == true
      unless badge.activities.activityable_object(activity.activityable).where(:user_id=>user.id).first
        # create activity 'achieve'
        achieve_activity = activity.activityable.activities.create(:user_id=>user.id,:name=>'achieve')
        badge.achievements.create(:user_id=>user.id,:trigger_id=>activity.id,:activity_id=>achieve_activity.id)
      end