FogBugz #62: correct has_one to belongs_to in model relationships.
This commit is contained in:
parent
df0821b2b8
commit
7bbf17314d
2 changed files with 7 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
|||
class Contact < ActiveRecord::Base
|
||||
has_many :emails, :dependent => :destroy
|
||||
has_many :phones, :dependent => :destroy
|
||||
has_one :address
|
||||
belongs_to :address
|
||||
|
||||
accepts_nested_attributes_for :emails, :reject_if => lambda { |a| a[:address].blank? }, :allow_destroy => true
|
||||
accepts_nested_attributes_for :phones, :reject_if => lambda { |a| a[:nr].blank? }, :allow_destroy => true
|
||||
|
|
|
|||
|
|
@ -25,10 +25,12 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="threecol">
|
||||
<%= c.street + " " + c.housenr %>
|
||||
<br />
|
||||
<%= c.plz + " " + c.place %><%= ", " unless c.country.blank? %>
|
||||
<%= c.country %>
|
||||
<% unless c.address.nil? %>
|
||||
<%= c.address.street + " " + c.address.housenr %>
|
||||
<br />
|
||||
<%= c.plz + " " + c.place %><%= ", " unless c.country.blank? %>
|
||||
<%= c.country %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="twocol">
|
||||
<%= " ".html_safe unless c.phones.count > 0 %>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue