Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. ### Belongs_to
  2. * Sets up a one-to-one connection with another model
  3. * Such that the model that *belongs_to* is assigned to the other model
  4. * *A book belongs_to an author*
  5. ```rb
  6. class Book
  7. belongs_to :author
  8. end
  9. ```
  10.  
  11. ### has_one
  12. * Also, is used to set up a one-to-one connection with another model
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement