Topic: help for rails app controller

im a new rails developper, and i try to create an action into a controller to do something like that:
when u user purshase an item, his godparent (user contact) will receive money.
i create the purshase controller it work fine, but i dont know how can i add this function.
also, i had create a model to the commission:

id - user_id - contact_id - ammount - date

the user model is like that:

id - user_name - ..... - contact - ....
1 - foo      - ...... -  Null -    
2 - bar      - ......   - foo

in the purshase controller i have :

def create
    @purchase =[:purchase])
    respond_to do |format|
        format.html { redirect_to @purchase, notice: 'La transaction a été créée.' }
        format.json { render json: @purchase, status: :created, location: @purchase }
        format.html { render action: