Does that still reject the object if the id attribute is not blank?
Do I have to test each attribute separately and exclude the id
attribute in order for that to work?

On Apr 14, 5:38 pm, Abhinav Saxena <[email protected]> wrote:
> 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,
> Abhinavhttp://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.

Reply via email to