Bug #158
contract can have duplicate engineer_users
| Status: | Closed | Start: | 02/25/2010 | |
| Priority: | High | Due date: | ||
| Assigned to: | Patrick Guiran | % Done: | 100% |
|
| Category: | Internal | Spent time: | - | |
| Target version: | 0.8.3 | |||
Description
You can add several times the same engineer_user to a Contract.
check a way to don't save duplicate users in the model
History
07/06/2010 02:51 AM - Patrick Guiran
closed. implemented in 0.8.3
in model
before_save :update_users
def update_users
# To make sure we have only once an engineer
self.engineer_users = self.engineer_users -
(self.teams.collect(&:users).flatten)
end
in ./script/console in the production platform
>> Contract.all.map { |c| c.engineer_user_ids.sort != c.engineer_user_ids.uniq.sort ? c.id : nil }.uniq
=> [nil]
07/06/2010 02:51 AM - Patrick Guiran
- Category set to Internal
- Status changed from Assigned to Closed
- Target version set to 0.8.3
- % Done changed from 0 to 100
closed. implemented in 0.8.3