How to remove empty object from array

Hello,

I have a view on which I accept multiple objects of the same model. I create an array like

@member_list= 5.times{   @member_list<<Member.new }

user can enter the data for upto 5 members on the same screen. Now how do I check whether a particular array entry is empty or not. For example, if user entered data for only 3 members then only 3 objects should be saved. How do I check for empty object? Also, is there any way to access validation error for individual object in the array i.e. if user missed first name in first and date of birth is not valid in 3rd then how can I get the errors separately for each object validation?

Thanks.

for erros you can call method errors on each model object.

the other one, im not really sure. But one thing I could think of is adding a virtual attribute on the model. and display a check box to the user wether to save the record or not. then you can iterate to check on that attribute first.

Ahmy Yulrizka