| 2008-06-10 06:34:23 | Ответить |
|---|---|
|
Ruslan Voloshin Адрес: odessa Сообщений: 1226 Регистр: 2007-03-13 его блог 40 сообщ. |
RE: Удаление связи при has and belongs to many |
|
Если я правильно понят твою задачу ты просто хочешь почистить таблицу и удалить все записи из таблицы Role
------------
destroy_all(conditions = nil) Destroys the objects for all the records that match the condition by instantiating each object and calling the destroy method. Example: delete_all(conditions = nil) Deletes the records matching conditions without instantiating the records first, and hence not calling the destroy method and invoking callbacks. This is a single SQL query, much more efficient than destroy_all. Options conditions Conditions are specified the same way as with find method. Example This deletes the affected posts all at once with a single DELETE query. If you need to destroy dependent associations or call your before_ or after_destroy callbacks, use the destroy_all method instead. Занимаюсь вебом и продвижением сайтов.
|
|
| delete_all, destroy_all |