SHARE
TWEET

Untitled

a guest Sep 13th, 2017 39 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
Top