Ruby on Rails Friday, August 31, 2012

Hi all i am following this like for basic paypal http://railscasts.com/episodes/141-paypal-basics
and i got this error


View:

<%= link_to "Checkout", @cart.paypal_url() %>

undefined method `paypal_url' for nil:NilClass
despite i have this code in my model called Card

Cart Model:

class Cart < ActiveRecord::Base





def paypal_url(return_url)
values = {
:business => '',
:cmd => '_cart',
:upload => 1,
:return => return_url,
:invoice => id
}
line_items.each_with_index do |item, index|
values.merge!({
"amount_#{index+1}" => 500,
"item_name_#{index+1}" => car,
"item_number_#{index+1}" => 5,
"quantity_#{index+1}" => 1
})
end
"https://www.sandbox.paypal.com/cgi-bin/webscr?" + values.to_query
end


end

it is unable to identify it

what is the problem


Cheers


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ph2CGAAof2cJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment