Skip to content

Commit 2c7bae3

Browse files
Add tip for inflector acronyms, like OAuth.
Fixes #41 Co-authored-by: Harrison Broadbent <harrisonbroadbent@gmail.com>
1 parent 0d55b33 commit 2c7bae3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ We've fixed this so you don't need to care, but this is what's happening.
6565
> [!TIP]
6666
> Plural Associated Object names are also supported: `Account.has_object :seats` will look up `Account::Seats`.
6767
68+
> [!TIP]
69+
> For certain names you may want to define an acronym like so:
70+
>
71+
> ```ruby
72+
> # config/initializers/inflections.rb
73+
> ActiveSupport::Inflector.inflections(:en) do |inflect|
74+
> inflect.acronym "OAuth" # ‘oauth’ → ‘OAuth’
75+
> end
76+
> ```
77+
>
78+
> Then `has_object :oauth_scopes` will look up `OAuthScopes`, instead of `OauthScopes`.
79+
6880
See how we're always expecting a link to the model, here `post`?
6981
7082
Because of that, you can rely on `post` from the associated object:

0 commit comments

Comments
 (0)