Skip to content

Commit

Permalink
user, place: destroy ownerships when model is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
zonque committed Apr 9, 2014
1 parent a47b093 commit 10c403a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/place.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Place < ActiveRecord::Base
:is_established, :description,
:type, :latitude, :longitude

has_many :ownerships
has_many :ownerships, dependent: :destroy
has_many :users, through: :ownerships
has_one :image
accepts_nested_attributes_for :image
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class User < ActiveRecord::Base

has_paper_trail

has_many :ownerships
has_many :ownerships, dependent: :destroy
has_many :places, through: :ownerships

validates :name, presence: true, length: { maximum: 100 }
Expand Down

0 comments on commit 10c403a

Please sign in to comment.