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
form.has_many cannot hide 'remove button' on new records #5445
Comments
I think this is a reasonable customization for users to make if they want and expect this behavior. Feel free to submit as a pull and we'll see if it is OK with Travis. I would want to see more supportive feedback from others before merging such a change. |
Great, I created a pull request, let me know if there's still anything that needs to be done. |
This change is not good. What if someone doesn't want to destroy persisted records, but wants to be able to add and delete (by 'remove' button) new records? Setting |
That's true. Unfortunately, it's impossible right now to configure the destroy button for new records, that's why I am suggesting this. Also, isn't it strange that the
I have a few ideas:
I favour option 1 because it's explicit—you get what you expect—but I guess that's too much of a compatibility break. Is option 2 fine for you? |
No, sorry, I don't like the option 2. As I have already sad, the You should also keep in mind that not only boolean can be passed as the By the way, using
|
Well then, maybe consider option 1 for active_admin 2.0. I think it's much more straight-forward and gives the user more control. Of course this could also be implemented with another option ( Thanks for your suggestion with |
Is there any update on this issue or has it gone stale? I see the one PR mentioned above (#5452) does that need a re-visit? |
I agree that |
I would accept a PR for that. There may be something for it already. |
I pre-build the attributes of associated objects for a new object and don't won't the customers to change their count. That's why I need to remove the 'remove' button (and the 'add new' button, but that works fine). My code looks like this:
f.has_many :sub_model, allow_destroy: false, new_record: false
. Unfortunately this still generates the 'remove' buttons. I know, most of the time that is wanted, but when I explicitly passfalse
to theallow_destroy
, I except them to disappear.I fixed this issue by patching the source in
activeadmin-1.3.0/lib/active_admin/form_builder.rb
:in
has_many_actions
:to
If there are no regressions, it would be great if you could add that upstream. Thanks for considering :)
The text was updated successfully, but these errors were encountered: