hi,
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:
[code]
id - user_id - contact_id - ammount - date
[/code]
the user model is like that:
[code]
id - user_name - ..... - contact - ....
1 - foo      - ...... -  Null -
2 - bar      - ......   - foo
[/code]
in the purshase controller i have :
[code]
def create
    @purchase = Purchase.new(params[:purchase])
    ......

    respond_to do |format|
      if @purchase.save



        format.html { redirect_to @purchase, notice: 'La transaction a
été créée.' }
        format.json { render json: @purchase, status: :created,
location: @purchase }
      else
        format.html { render action:
[/code]

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/6b5e8a1d5e6bab89c57e5368ea52efd0%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to