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

Adds inverse_relationship to Relationship options #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/v0.10/guide/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ The relationship methods (`relationship`, `has_one`, and `has_many`) support the
* `always_include_linkage_data` - if set to true, the serialized relationship will include the type and id of the related record under a `data` key. Defaults to false if not set.
* `eager_load_on_include` - if set to false, will not include this relationship in join SQL when requested via an include. You usually want to leave this on, but it will break 'relationships' which are not active record, for example if you want to expose a tree using the `ancestry` gem or similar, or the SQL query becomes too large to handle. Defaults to true if not set.
* `exclude_links` - accepts either `:default`, `:none`, or and array containing the specific default links to exclude, which may be `:self` and `:related`. Use this to supress warning for links which are not routeable or when you wish to prevent a client from following the links.
* `inverse_relationship` - a string/symbol specifying the inverse name of the relationship. In general, this should match the `inverse_of` property of the `ActiveRecord` model. Defaults to `<relation_name>.pluralize` for has_one relationships and `<resource_name>.singuralize` for has_many relationships.

`to_one` relationships support the additional option:
* `foreign_key_on` - defaults to `:self`. To indicate that the foreign key is on the related resource specify `:related`.
Expand Down