Skip to content

Instantly share code, notes, and snippets.

@jwo
Created August 12, 2014 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwo/3587b0aa24e8679e537c to your computer and use it in GitHub Desktop.
Save jwo/3587b0aa24e8679e537c to your computer and use it in GitHub Desktop.
scholastic.rb
class User
has_many :orders
attr_accessor :name
attr_accessor :devise
end
class Book
has_many :line_items
has_many :orders, through: :line_items
attr_accessor :title
attr_accessor :author
attr_accessor :inventory
attr_accessor :sales_price
attr_accessor :msrp
end
class Order
belongs_to :user
has_many :line_items
has_many :books, through: :line_items
attr_accessor :stripe_charge_id
end
class Lineitem
belongs_to :order
belongs_to :book
attr_accessor :quantity
attr_accessor :price_paid
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment