I need to call method for each user(admin part), which has email parameter. It is a function for paying in PayPal, but I can't use redirection in instances.
Code from my view payments.erb:
% @users.each do |user| %>
<li>
<%= user.email %>
<%= link_to "Pay", user.pay(user.email) %>
</li>
Code of pay method
def pay email
//making post request to PayPal
//res = clnt.post(uri, data, header)
//if res.status ==200
//redirect_to PayPal
//else redirect_to :back
end
How I can pass parameters or how can I reorganize this all ? Do I need to create an action in pages controller, or can I use some after_call_pay function ?