form not creating new entries

后端 未结 2 1216
半阙折子戏
半阙折子戏 2021-01-28 11:49

I am trying to create a form to add a transporter: I have app/views/transporters/new.html.erb that calls a template,app/views/_form.html.erb that looks like:

<         


        
相关标签:
2条回答
  • 2021-01-28 12:39

    use

     @transporter = Transporter.new(params[:transporter])
    

    or

    @transporter = Transporter.new(params["transporter"])
    

    check my last comment to save it.

    0 讨论(0)
  • 2021-01-28 12:46

    You just create a new object with your params from the form in your create action, but you don't save it. add @transporter.save to your create action.

    0 讨论(0)
提交回复
热议问题