1

) 我对 Ruby 很陌生,所以请放纵 ;-)

我正在尝试在引导模式中设置登录表单,但我保持与以下相同的消息错误:Pages#home 中的 NameError

显示 /Users/raphaelbendenoun/code/isrcovoit/app/views/pages/home.html.erb 其中第 78 行提出:

#<#:0x00000101366738> 的未定义局部变量或方法 `resource' 提取的源(在 #78 行附近):

75:     <h3> id="myModalLabel">Modal header</h3>
76:   </div>
77:   <div class="modal-body">
78:     <%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => 'form-horizontal'}) do |f| %>
79:           <div class="inputs">
80:             <%= f.input :email, :required => false, :autofocus => true %>
81:             <%= f.input :password, :required => false %>
Rails.root: /Users/raphaelbendenoun/code/isrcovoit

应用程序跟踪 | 框架跟踪 | 完整跟踪 app/views/pages/home.html.erb:78:in `_app_views_pages_home_html_erb__571334819088820889_2157665500'

这是我的代码:

 <!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close"  aria-hidden="true">×</button>
    <h3> id="myModalLabel">Modal header</h3>
  </div>
  <div class="modal-body">
    <%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => 'form-horizontal'}) do |f| %>
          <div class="inputs">
            <%= f.input :email, :required => false, :autofocus => true %>
            <%= f.input :password, :required => false %>
            <%= f.input :remember_me, :as => :boolean if devise_mapping.rememberable? %>
          </div>
  </div>
    <div class="modal-footer">
        <%= f.button :submit, "Sign in", :class => 'btn btn-primary', :data => { :dismiss => "modal"} %>
        <% end %>
    </div>
</div>

我错过了什么??非常感谢您的帮助,欢迎所有提示

4

0 回答 0