我正在遵循一个教程,当我尝试在表单中添加f.hidden_field
标签时,会出现此错误。
未定义的局部变量或方法'f'
<h1>Signing up for "<%= @subscription.plan.name %>"</h1>
<%= f.hidden_field :paypal_customer_token %>
<%= f.hidden_field :paypal_payment_token %>
<% if @subscription.paypal_payment_token.present? %>
<H1>Payment has been provided </H1>
<% else %>
<div class="field">
<%= radio_button_tag :pay_with, :paypal %>
<%= label_tag :pay_with_paypal do %>
<%= image_tag "paypal.png" %>
<% end %>
<%= link_to "paypal.png", paypal_checkout_path(:plan_id => @subscription.plan_id) %>
<% end %>
答案 0 :(得分:5)
要么该教程已损坏,要么您错过了他们这样做的那一行:
<%= form_for @subscription do |f| %>