0

我在and模型user.html.haml之外的视图 ( ) 中有以下内容:apps_controllerApp

#myModal.modal.hide.fade{"aria-hidden" => "true", "aria-labelledby" => "myModalLabel", :role => "dialog", :tabindex => "-1"}
            .modal-header
              %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", :type => "button"} ×
              %h3#myModalLabel Add Mobile App
              = form_for @app, class: 'modal-body' do |f|
                = f.label :name, class: 'pull-left'
                = f.text_field :name, style: 'width: 500px;'

                .modal-footer
                  %button.btn{"aria-hidden" => "true", "data-dismiss" => "modal"} Close
                  = f.submit "Save App", class: "btn btn-primary" 

这当前成功地将数据保存到App模型中,但它没有触发我在App模型中的验证。

当在与模型不同的视图中生成记录时,验证不起作用是否有原因?

4

0 回答 0