Now, what I would like to do is to delete not only the user but also the
airlinmembership info asssocciated with that user when a delete action
occurs. Now, I suppose I could do a find_by_id( user.id ) to go through
all the tables and destroy all assocciated info, but I’m thinkin that
there has to be an easier way in RoR. Plus, there are many many tables
that a user may have info in which make the code not ugly but certaintly
long.
Also, I know about the rails framework API: http://api.rubyonrails.org/,
but it seems like this site fails to really explain all the attributes
that can be used in a helper method, for example. I was wondering if
anyone knows of a better site that explains maybe a little better or
might provide some better examples? Thanks all,
Now, what I would like to do is to delete not only the user but also the
airlinmembership info asssocciated with that user when a delete action
occurs. Now, I suppose I could do a find_by_id( user.id ) to go through
all the tables and destroy all assocciated info, but I’m thinkin that
there has to be an easier way in RoR. Plus, there are many many tables
that a user may have info in which make the code not ugly but certaintly
long.
Also, I know about the rails framework API: http://api.rubyonrails.org/,
but it seems like this site fails to really explain all the attributes
that can be used in a helper method, for example. I was wondering if
anyone knows of a better site that explains maybe a little better or
might provide some better examples? Thanks all,
~S
Couldn’t you just use the foreign key and set the option cascade on
delete? So that way, any record that has your client_id would be
deleted. I hope this helps.