You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classPostsController < ApplicationControllerdefnew# view renders form_with model: @post, including validation errors from previous form submission (if present)@post=flash_pack[:post] || Post.newenddefcreatepost=Post.new(post_params)ifpost.saveredirect_toanother_controller_actionelse# pack the post into the flashflash_pack[:post]=postendendend
Since the extension shipped by the gem is for ActiveRecord::Base, I think out-of-the-box support for errors would be great! I imagine this behavior could be toggled with an additional prepack option, include_errors.
Happy to write a PR if this sounds reasonable to you! Thanks again for all of your contributions to the ruby and rails ecosystems.
The text was updated successfully, but these errors were encountered:
Hello and thanks for this fantastic gem!
In my app, I've monkeypatched the provided
pack_with
andunpack_with
methods for theActiveRecord::Base
extension to include errors by default:This has opened up a really nice little flow in my controllers with the help of a simple utility class:
Since the extension shipped by the gem is for
ActiveRecord::Base
, I think out-of-the-box support for errors would be great! I imagine this behavior could be toggled with an additional prepack option,include_errors
.Happy to write a PR if this sounds reasonable to you! Thanks again for all of your contributions to the ruby and rails ecosystems.
The text was updated successfully, but these errors were encountered: