我有一个来自 URL 的参数 (params[:authorization]),如您所见:
authorization_selected = params[:authorization]
new_parcel = params[:new_parcel].to_i
puts authorization_selected.class (in the console show type String)
puts new_parcel.class (in the console show type Fixnum)
在我的控制器中,有:
@portability = Portability.new
@portability.employee_id = authorization_selected.employee_id
但是,这会返回一个错误:
undefined method `employee_id' for 3:Fixnum
我需要两者都是整数。怎么做?