You can do like this using all? method
accepts_nested_attributes_for :questions, :allow_destroy => true,
:reject_if => lambda { |attrs| attrs.all? { |k, v| v.blank?}}
--
Thanks,
Abhinav
http://twitter.com/abhinav
On Wed, Apr 14, 2010 at 7:51 PM, ES <[email protected]> wrote:
> How do I reject the creation of an object if all of the attributes are
> blank?
>
> accepts_nested_attributes_for :questions, :allow_destroy =>
> true, :reject_if => lambda {|a| a.each.blank? }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.