Skip to content
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

Make error status for HTML/JS responses fully configurable #240

Merged
merged 4 commits into from
Jan 29, 2023

Conversation

carlosantoniodasilva
Copy link
Member

This essentially makes the previous change merged via #223 configurable,
so that we can keep the current behavior on existing apps, returning 200 OK even for errors, while changing the generator for new apps to be configured with 422 Unprocessable Entity, making them work better with Hotwire/Turbo installations out of the box.

Please note that these defaults are likely to be swapped in a future major version of Responders.

This essentially makes the previous change merged via #223 configurable,
so that we can keep the current behavior on existing apps, returning
`200 OK` even for errors, while changing the generator for new apps to
be configured with `422 Unprocessable Entity`, making them work better
with Hotwire/Turbo installations out of the box.

Please note that these defaults are likely to be swapped in a future
major version of Responders.
We want to change these defaults for all apps eventually, so making sure
new apps are generated with them by default will make this an easier
transation to some in the future.
If an app happens to have multiple responders on different controllers
(which is entirely possible), they may not want to share the same set of
statuses for responses. `cattr_accessor` would make that a global value
across all of the apps responders, while `class_attribute` can be
changed on each class individually if necessary (while still respecting
the inherited values if any is set), making it much more flexible.

Also disable instance writer and predicate methods, we only need access
to read those values from the instance.
Just make it clearer how Hotwire/Turbo expects this to work, and how you
can make responders work better with it.

Please note that a future major version of responders might change the
defaults to work that way out of the box, without explicit configs.

[ci skip]
@carlosantoniodasilva carlosantoniodasilva merged commit fb9f787 into main Jan 29, 2023
@carlosantoniodasilva carlosantoniodasilva deleted the ca-config-errors branch January 29, 2023 13:21
tagliala pushed a commit to tagliala/inherited_resources that referenced this pull request Jun 6, 2024
Update responder class to the current defaults for responder gem

Close: activeadmin#862

Ref: heartcombo/responders#240
tagliala pushed a commit to tagliala/inherited_resources that referenced this pull request Jun 12, 2024
Update responder class to the current defaults for responder gem

Close: activeadmin#862

Ref: heartcombo/responders#240
tagliala pushed a commit to tagliala/inherited_resources that referenced this pull request Jun 14, 2024
Update responder class to the current defaults for responder gem

Close: activeadmin#862

Ref: heartcombo/responders#240
javierjulio pushed a commit to tagliala/inherited_resources that referenced this pull request Jun 15, 2024
Update responder class to the current defaults for responder gem

Close: activeadmin#862

Ref: heartcombo/responders#240
tagliala pushed a commit to tagliala/inherited_resources that referenced this pull request Jun 15, 2024
Update responder class to the current defaults for responder gem.

`HttpCacheResponder` was deliberately excluded in version 1.8.0

Close: activeadmin#862

Ref:
- heartcombo/responders#240
- a9fb8e1
tagliala pushed a commit to tagliala/inherited_resources that referenced this pull request Jun 15, 2024
Update responder class to the current defaults for responder gem.

`HttpCacheResponder` was deliberately excluded in version 1.8.0

Close: activeadmin#862

Ref:
- heartcombo/responders#240
- a9fb8e1
javierjulio pushed a commit to tagliala/inherited_resources that referenced this pull request Jul 2, 2024
Update responder class to the current defaults for responder gem.

`HttpCacheResponder` was deliberately excluded in version 1.8.0

Close: activeadmin#862

Ref:
- heartcombo/responders#240
- a9fb8e1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant