Skip to content

Commit

Permalink
Require that city and country be included on all new addresses.
Browse files Browse the repository at this point in the history
  • Loading branch information
djcp committed Jun 25, 2009
1 parent e562ee9 commit 271c37c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Contact < ActiveRecord::Base
:reject_if => proc { |attributes| attributes['email'].blank? }

accepts_nested_attributes_for :contact_addresses, :allow_destroy => true,
:reject_if => proc { |attributes| attributes['street1'].blank? }
:reject_if => proc { |attributes| (attributes['city'].blank? or attributes['country'].blank?) ? true : false }

accepts_nested_attributes_for :contact_urls, :allow_destroy => true,
:reject_if => proc { |attributes| attributes['url'].blank? }
Expand Down
1 change: 1 addition & 0 deletions app/views/contacts/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
</tr>
<% end %>
</table>
<p><strong>City and Country are required on new addresses.</strong></p>
</div>

<h2 id="flyout-contact-contact-info" class="toggle shown">Contact Info</h2>
Expand Down

0 comments on commit 271c37c

Please sign in to comment.