8000 On delete: cascade! :) · brusmax/demo.activeadmin.info@2a8f860 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a8f860

Browse files
committed
On delete: cascade! :)
1 parent e23a0b4 commit 2a8f860

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/models/order.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Order < ActiveRecord::Base
2-
has_many :line_items
2+
has_many :line_items, :dependent => :destroy
33
belongs_to :user
44

55
scope :in_progress, where("orders.checked_out_at IS NULL")

app/models/user.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class User < ActiveRecord::Base
22

3-
has_many :orders
3+
has_many :orders, :dependent => :destroy
44

55
# new columns need to be added here to be writable through mass assignment
66
attr_accessible :username, :email, :password, :password_confirmation

0 commit comments

Comments
 (0)
0