我正在我的应用程序中开发支付系统。为此,我参考了 railcasts ep-141,我按照剧集执行了所有步骤,但我收到了这个错误
undefined method `paypal_url'
我试过了,但没有找到答案。
这里我有 BookingDetail madel 如下
class BookingDetail < ActiveRecord::Base
belongs_to :room
attr_accessible :member_type_id, :room_type_id, :start_date, :end_date, :room_rate_id, :room_no, :customer_id, :room_id
def total_price
room_type.to_a.sum(&:room_rate)
end
def paypal_url(return_url)
values = {
:business => '',
:cmd => '_cart',
:upload => 1,
:return => return_url,
:invoice => id
}
room_type.each_with_index do |item, index|
values.merge!({
"room_rate_#{index+1}" => item.room_rate,
"room_type_#{index+1}" => item.room_type,
"room_id_#{index+1}" => item.room_rate.room_id,
"quantity_#{index+1}" => item.quantity
})
end
"https://www.sandbox.paypal.com/cgi-bin/webscr?" + values.to_query
end
结尾
这条线给了我错误
<%=link_to "Checkout",@room.paypal_url(rooms_url)%>
我该怎么办?