Support id_column and index_column in table_for#6461
Support id_column and index_column in table_for#6461c960657 wants to merge 13 commits intoactiveadmin:masterfrom
Conversation
deivid-rodriguez
left a comment
There was a problem hiding this comment.
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.
Are these and the other changes in this file related to this PR?
There was a problem hiding this comment.
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.
bb23b36 to
8666eb2
Compare
deivid-rodriguez
left a comment
There was a problem hiding this comment.
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.
| `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.