Simplify _prefixes#15026
Conversation
|
If the goal is to make |
… up the inheritance chain, classes can override local prefixes.
|
Totally agree about the proper documentation and testing and I will add that once you give me the OK 😁 Overriding on the instance level is still possible by overriding I don't know what's the deal with those underscored methods, we can remove them, I don't see what they stand for. Thanks for your prompt relpy, @josevalim! |
|
Underscored methods are private. They are not supposed to be removed if they are meant to be private. |
|
The problem is that those methods should be public but might interfere with actual controller actions. If I personally find it OK to leave them underscored, just to avoid the hassle with name clashes. Other than that my only concern is that I ruthlessly removed |
|
Here's what I wanna do.
|
|
@apotonick seems a good plan. Also I think if |
|
@rafaelfranca Do you have an example where a method is marked as deprecated if it is defined (in Rails)? I will then inform the user about the deprecation of |
|
hmmm. I don't think we have this. I thought we want to deprecate the usage not the definition. So I guess the only way if checking when calling |
|
Yeah, that's what I meant as well - I just thought there's an automation in Rails for that 😉 |
|
There are some helpers but I prefer to call |
|
This guy is ready to be merged, @rafaelfranca and @josevalim. |
There was a problem hiding this comment.
This method should be private
|
We still need tests overriding |
…ation for overriding ::_parent_prefixes.
|
I added tests for overriding |
|
Hi @rafaelfranca - this is ready to be merged, rebased and squashed in https://github.com/apotonick/rails/tree/simplify-prefixes. Thanks ❤️ |
|
Do you want me to |
|
Oh, and thanks! |
|
Yes. For us it is better. |
|
For me, too! And again, thanks for this prompt and uncomplicated merge, I really really appreciate the "open-ness" in the core towards architectural changes. ❤️ |
Summary
This simplifies the logic to compile the
_prefixesarray used for view inheritance. The change allows overriding::_local_prefixeswhich didn't work before.Implementation
It is now implemented with a proper recursion travelling up the inheritance chain instead of doing all the work locally in the concrete controller. Controllers in the chain can now define their local
_prefixesby overriding_local_prefixes(we can rename that). This didn't work before.We use this extensively in Cells for the new Trailblazer file layout. I thought it might be helpful to push that back to the core.