尝试在Rails模型上分配属性时,我遇到了一个奇怪的字符串错误:
# POST /apartments
# POST /apartments.xml
def create
@apartment = Apartment.new(params[:apartment])
PARAMS
{"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
思想?