尝试在 Rails 模型上分配属性时出现奇怪的字符串错误:
# POST /apartments
# POST /apartments.xml
def create
@apartment = Apartment.new(params[:apartment])
参数
{"utf8"=>"✓",
"authenticity_token"=>"Kxxxxx=",
"apartment"=>{"street"=>"123 Main St",
"unit"=>"",
"hide_address"=>"0",
"city"=>"White Plains",
"state"=>"New York",
"zipcode"=>"10840",
"country"=>"United States",
"price"=>"4000",
"security_deposit"=>"",
"application_fee"=>"",
"bedrooms"=>"4",
"bathrooms"=>"3",
"size"=>"",
"available_date"=>"",
"unit_amenities"=>["air conditioning"],
"description"=>"",
"rooms"=>"1"},
"commit"=>"Publish Your Listing"}
错误
NoMethodError in ApartmentsController#create
undefined method `each' for "1":String
想法?