Conversation
bce9735 to
58219f1
Compare
58219f1 to
836cbe7
Compare
|
@pablobm |
|
Could this be done differently, in a more flexible way? For example, we could have a |
|
I’m working on refactoring the controllers, and I expect that the save operation itself will likely be split into methods like this in the future: This would allow users to customize the Since What do you think? |
|
The initial problem is probably with me: I don't think I have ever used validation contexts in the real world 😅 They sound great, but for one reason or the other I haven't ended up using them. Perhaps they are more common in the wider Rails community than they are in my own bubble, so I can entertain the option. But then I think a bit more and remember that |
This pull request introduces support for customizable validation contexts when creating or updating resources in the
Administratecontrollers. This allows developers to specify different validation scenarios based on user roles or other conditions, providing more flexibility for resource validation logic. Documentation and tests have been updated to reflect and verify this new functionality.Controller enhancements for validation contexts:
validation_contexts_on_createandvalidation_contexts_on_updatemethods toAdministrate::ApplicationController, allowing developers to override and specify custom validation contexts for resource creation and update. The default context is:createor:updatebased on whether the record is new. (app/controllers/administrate/application_controller.rb)Documentation updates:
docs/customizing_controller_actions.md.Testing improvements:
spec/controllers/admin/application_controller_spec.rb.Usage: