さて、24 行目で nil:NilClass の未定義メソッド「new」を取得しています。これは私のデバイス/登録/new.html.erb にあります。
19 <div class="span8">
20 <hr/>
21 </div>
22 <h4 class="span8">Address</h4>
23 <div class="address">
24 <%=f.simple_fields_for :address, collection: [resource.address.new] do |addr_form| %>
25 <div class="span7">
26 <%=addr_form.input :addrl1, required: true, label: "Street Address", input_html: {:class => "input-block-level"}%>
27 </div>
28 <div class="span7">
29 <%=addr_form.input :addrl2, label: "Address Line 2", input_html: {:class => "input-block-level"}%>
デバイス/登録/new.html.erb:
<div class="span9 form_user_signup">
<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: {class: ""}) do |f| %>
<%= f.error_notification %>
<h2 class="form-signin-heading">Sign up</h2>
<div class="note">
Please fill out the following appliation to get started. (view <a href="#" target="_blank">privacy policy</a>).
</div>
<hr/>
<h4 class="span8">Contact Information</h4>
<div class="span7">
<%= f.input :email, :required => true, :autofocus => true, input_html: {:class => "input-block-level"} %>
</div>
<div class="span7">
<%= f.input :password, :required => true, input_html: {:class => "input-block-level"} %>
</div>
<div class="span7">
<%= f.input :password_confirmation, :required => true, input_html: {:class => "input-block-level"} %>
</div>
<div class="span8">
<hr/>
</div>
<h4 class="span8">Address</h4>
<div class="address">
<%=f.simple_fields_for :address, collection: [resource.address.new] do |addr_form| %>
<div class="span7">
<%=addr_form.input :addrl1, required: true, label: "Street Address", input_html: {:class => "input-block-level"}%>
</div>
<div class="span7">
<%=addr_form.input :addrl2, label: "Address Line 2", input_html: {:class => "input-block-level"}%>
</div>
<div class="span4">
<%=addr_form.input :city, required: true, label: "City"%>
</div>
<div class="span4">
<%=addr_form.input :state, required: true, collection: states, label: "State", value_method: :abbr, include_blank: 'Select State'%>
</div>
<div class="span4">
<%=addr_form.input :region_code, required: true, label: "Postal / Zip Code"%>
</div>
<% end %>
</div>
<div class="span8">
<hr/>
</div>
<div class="form-inputs">
<%= f.button :submit, "Sign up", class: "btn btn-large btn-primary " %>
</div>
<div class="form-inputs pull-right">
<%= link_to "Already have an account?", new_user_session_path, class: " " %>
</div>
<% end %>
</div>
ユーザー.rb:
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:confirmable, :lockable
has_one :address
end
アドレス.rb:
class Address < ActiveRecord::Base
attr_accessible :name, :addrl1, :addrl2, :city, :state, :region_code
belongs_to :user
end
助けてくれてありがとう。
皆様の助けが必要な情報が他にもあれば、私が提供します。