我有以下作用在我的控制器未定義的方法`的update_attributes'爲#<陣列:0xb5d61608>導軌4
cust = Customer.where(email: '[email protected]').pluck(:post_id)
@posts = Post.find(cust)
if params[:status]
if @posts.update_attribute(:customer_id, customer_id)
respond_to do |format|
format.json { render json: 'test'}
end
end
end
上面update_attribute拋出未定義的方法錯誤。
卡斯特將返回的ID陣列如[1,2,3]
我怎樣才能做到這一點
爲什麼我需要先添加?我使用pluck來生成不僅僅是第一個id值的數組 – overflow