Sha256: 0edb7ce2d5e09e7164c5be07f76dc2b21b286a35e8494bc41860b4460598822d
Contents?: true
Size: 959 Bytes
Versions: 3
Compression:
Stored size: 959 Bytes
Contents
class PatronMergeList < ActiveRecord::Base attr_accessible :title has_many :patron_merges, :dependent => :destroy has_many :patrons, :through => :patron_merges validates_presence_of :title paginates_per 10 def merge_patrons(selected_patron) self.patrons.each do |patron| Create.update_all(['patron_id = ?', selected_patron.id], ['patron_id = ?', patron.id]) Produce.update_all(['patron_id = ?', selected_patron.id], ['patron_id = ?', patron.id]) Own.update_all(['patron_id = ?', selected_patron.id], ['patron_id = ?', patron.id]) Donate.update_all(['patron_id = ?', selected_patron.id], ['patron_id = ?', patron.id]) patron.destroy unless patron == selected_patron end end end # == Schema Information # # Table name: patron_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