Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solution/many-to-many Author model #19

Open
neugierige opened this issue Nov 17, 2016 · 1 comment
Open

solution/many-to-many Author model #19

neugierige opened this issue Nov 17, 2016 · 1 comment

Comments

@neugierige
Copy link

currently, we have:

class Author < ActiveRecord::Base
  has_many :books, through: :loans
  has_many :loans, dependent: :destroy
end

This suggests that the authors' relationship to their own books have to go through loans, which is illogical. It also states that authors have many loans, and that destroying loans would also destroy authors.

I propose the following:

class Author < ActiveRecord::Base
  has_many :books
end
@jrhorn424
Copy link
Contributor

See #8 for possible resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants