我正在提交一个表单来创建我的 SpecialDeal 模型的新记录。提交的参数如下所示:
@_params
{"utf8"=>"✓", "authenticity_token"=>"cl1SwnHOum8d/kiGnwkDsamG5IMbmdnoeFvlY11KpKc=", "special_deal"=>{"title"=>"5", "provider"=>"5", "description"=>"5", "deal_price"=>"", "conditions"=>"", "expires"=>"07/18/2013 14:38:18", "excerpt"=>"", "original_price"=>"", "phone_number"=>"", "street"=>"", "city"=>"", "postal_code"=>"", "state"=>"", "country"=>""}, "commit"=>"Create Special deal", "action"=>"create", "controller"=>"special_deals"}
然而,当我尝试从expires
参数中创建一个变量时......
def create
expiration = params[:expires]
该变量总是将自己设置为 nil!
Local Variables
expiration: nil
为什么会这样?