我是 ruby 和 rails 的新手,在我的学习中,我创建了我的 Order 的 Payment Types 数组。
class Order < ActiveRecord::Base
PAYMENT_TYPES = [{:id => "check", :name => "Check"}, {:id => "credit_card", :name => "Credit card"}, {:id => "purchase_order", :name => "Purchase order"}]
我想用这种方式
<%= f.select :pay_type, Order::PAYMENT_TYPES.each {|order| [order.name, order.id]}, :prompt => 'Select a payment method' %>
但我收到了这个错误
undefined method `name' for {:id=>"check", :name=>"Check"}:Hash
怎么了?