Having difficulty accessing validation errors in Sinatra

前端 未结 2 1055
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-07 03:07

I have a very basic form, with some very basic validations (though I need to create a custom validation later... you\'ll probably see a question on that tomorrow. =P ), but

2条回答
  •  醉梦人生
    2021-01-07 03:46

    Can you try this :

    post '/' do
      @entry = Entry.new(:first_name => params[:first_name], :last_name => params[:last_name], :email => params[:email])
    
      if @entry.save
        redirect("/thanks")
      else
        @title = "Enter to win a rad Timbuk2 bag!"
        erb: welcome
      end
    end
    

提交回复
热议问题