From 88d58041b65d41f1d425c43d8e236aaa4323ce29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20A=C3=B1asco?= Date: Mon, 9 Nov 2015 10:54:41 -0500 Subject: [PATCH] should be 'posts' in query example for belongs_to options --- en/docs/associations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en/docs/associations.md b/en/docs/associations.md index c99e79f..213ee5e 100644 --- a/en/docs/associations.md +++ b/en/docs/associations.md @@ -66,7 +66,7 @@ You can pass the following options as the 2nd argument to belongs_to on a Post m :collection - the name of the collection in the database, and the class that should be loaded when the models are returned :foreign_key - (the field name on the model that this model belongs to, defaults to :id) If you did: ```belongs_to :user, foreign_key: :user_system_id``` it would do the following query: -```store.users.where(user_system_id: self.user_id).first``` +```store.posts.where(user_system_id: self.user_id).first``` :local_key - the key on this model that should be used to lookup the belongs_to association - defaults to the belongs_to collection name + "_id". If you did: ```belongs_to :user, local_key: :remote_user_id``` it would do the following query: -```store.users.where(user_id: self.remote_user_id).first``` +```store.posts.where(user_id: self.remote_user_id).first```