This project is archived and is in readonly mode.
:any_blank and :all_blank options for accepts_nested_attributes_for :reject_if
-
Adam McCrea
+1 This feels much cleaner, and I agree that these will be the most common scenarios.
-
Carlos Antonio da Silva
It seems reasonable for me to have this patterns, as I've been writing similar procs several times.
-
Trent Ogren
+1
-
Zach Holman
+1
-
Mike Breen
Thanks for all the +1 love but in order for core to take this seriously you'll need to add just a little bit more.
Thanks again. Mike
-
Mike Breen
- Assigned user set to Michael Koziarski
After talking with Koz the :any_blank is being dropped. The thinking is that you'd be better served by validations there.
-
Mike Breen
Is there a reason we can't get this patch into 2-3-stable. It applies cleanly.
-
CancelProfileIsBroken
- State changed from resolved to open
Seems a good candidate for backport to 2-3-stable.
-
Michael Koziarski
- Milestone changed from 2.x to 2.3.4
-
Steve Richert
- Tag cleared.
The
:reject_ifoption receives a Proc that's called on the attributes hash. If thisall_blankusage is important enough to integrate intoaccepts_nested_attributes_for, why not include it in ActiveSupport's Hash extensions. Then it can be used withaccepts_nested_attributes_foras follows:accepts_nested_attributes_for :author, :reject_if => :all_blank?.to_procEven better, it'd be nice to see the
:reject_ifoption handle theto_procbit on its own. This would open:reject_ifup to very easily use whatever other fancy Hash methods are floating around out there. -
Eloy Duran
- Assigned user changed from Michael Koziarski to Eloy Duran
-
Repository
- State changed from open to resolved
(from [69db137f891e0ff5577eeab72da6600db1d2cbcf]) Allows you to pass :all_blank to :reject_if option to automatically create a Proc that will reject any record with blank attributes.
[#2501 state:resolved]
Signed-off-by: Eloy Duran eloy.de.enige@gmail.com
http://github.com/rails/rails/commit/69db137f891e0ff5577eeab72da660... -
Jeff Kreeftmeijer
Automatic cleanup of spam.
-
Aditya Sanghi
Automatic cleanup of spam.
