Class: AgentMergeList
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- AgentMergeList
- Defined in:
- app/models/agent_merge_list.rb,
app/models2/agent_merge_list.rb
Instance Method Summary collapse
Instance Method Details
#merge_agents(selected_agent) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'app/models/agent_merge_list.rb', line 8 def merge_agents(selected_agent) self.agents.each do |agent| Create.where(agent_id: selected_agent.id).update_all(agent_id: agent.id) Produce.where(agent_id: selected_agent.id).update_all(agent_id: agent.id) Own.where(agent_id: selected_agent.id).update_all(agent_id: agent.id) Donate.where(agent_id: selected_agent.id).update_all(agent_id: agent.id) agent.destroy unless agent == selected_agent end end |