-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Support id_column and index_column in table_for #6461
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
base: master
Are you sure you want to change the base?
Conversation
deivid-rodriguez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just made a few comments, but this PR looks very good!
| ActiveAdmin.register User | ||
| ActiveAdmin.register Post do | ||
| belongs_to :user | ||
| belongs_to :author, class_name: "User", param: "user_id", route_name: "user" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these and the other changes in this file related to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they are needed. I am not too familiar with belongs_to, but AFAICT the arguments are necessary for this to work at all (because the class name, User, does not match the attribute name, author). But I don't understand why the tests did not fail before. I'll try to figure out what is going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you figure it out @c960657?
bb23b36 to
8666eb2
Compare
deivid-rodriguez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a very small grammar comment, and also curious about why specs didn't fail before without the belongs_to options.
If you can also rebase while fixing the grammar nit, that'd be great.
And sorry for the long delay 🙏.
docs/12-arbre-components.md
Outdated
| The `column` method can take a title as its first argument and data | ||
| (`:your_method`) as its second (or first if no title provided). Column also | ||
| takes a block. | ||
| `column`, `index_column`, and `id_column` works like for [index tables](3-index-pages/index-as-table.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `column`, `index_column`, and `id_column` works like for [index tables](3-index-pages/index-as-table.md). | |
| `column`, `index_column`, and `id_column` work like for [index tables](3-index-pages/index-as-table.md). |
I think "work" is grammatically correct?
8666eb2 to
4cb4bf8
Compare
Likewise :-)
The difference is caused by the change from |
|
We also need |
id_columnandindex_columnare not only useful in index tables but also intable_for. Move these two methods to the parent case, so they are available for any table.I renamed the
i18noption fortable_fortoresource_class(with fallback toi18nfor BC), because with this change, the specified model is used not only for i18n purposes but also for determining the primary key.