I have a scenario where I have to prevent objects from saving to the
database if they have a certain value and I want to come up with the
optimal way to achieve that.

In my scenario, upon form submit, I will send 20 rows to the update
action in the controller.  However, I want to discard the 95% of them
that have a particular attribute value to save database rows.

I'm not sure I want to traverse the hashes:
params[:parentobject][:childobject][:grandchildobject][10][attributes][....
within the update action and loop  through the objects and delete them
if they have a particular value.

doing a before_save method within the model being destroyed:
self.destroy if self.status = "something"
doesn't seem to be a good option.

Any other ideas?

-- 
Posted via http://www.ruby-forum.com/.

-- 
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