Sha256: 9d5e2c906e1a01560347131505429e44da126caf8280536a2d5c9633678874d9
Contents?: true
Size: 885 Bytes
Versions: 3
Compression:
Stored size: 885 Bytes
Contents
class AgentMergeList < ActiveRecord::Base attr_accessible :title has_many :agent_merges, dependent: :destroy has_many :agents, through: :agent_merges validates_presence_of :title paginates_per 10 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 end # == Schema Information # # Table name: agent_merge_lists # # id :integer not null, primary key # title :string(255) # created_at :datetime not null # updated_at :datetime not null #
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
enju_biblio-0.1.0.pre62 | app/models/agent_merge_list.rb |
enju_biblio-0.1.0.pre61 | app/models/agent_merge_list.rb |
enju_biblio-0.1.0.pre60 | app/models/agent_merge_list.rb |