Commit d8593ccbf881f51b7a19e97b8d83ccbc627ff325

SourceImportation#uri
  
4545 end
4646 old_source_importation.touch
4747 else
48 link = entry.links.select{ |l| l['rel'] = 'alternate' }.first.try(:href)
49 uri = link.present? ? Uri.find_or_create_by_uri(link) : nil
50
4851 # Create new Importation
4952 source_importations.create :importation => importation_class.new.from_atom!(entry),
50 :guid => entry.id
53 :guid => entry.id,
54 :uri => uri
5155 end
5256 end
5357
5458 update_attribute :imported_at, Time.now
5559 end
60
61 # Destroy all importations and reset imported_at
62 def reset
63 source_importations.destroy_all
64 update_attribute :imported_at, nil
65 end
66
5667
5768 protected
5869
  
11class SourceImportation < ActiveRecord::Base
22 belongs_to :source
33 belongs_to :importation, :polymorphic => true, :dependent => :destroy
4 belongs_to :uri
45end
  
1818 create_table :source_importations do |t|
1919 t.references :source
2020 t.references :importation, :polymorphic => true
21 t.references :uri
2122 t.string :guid
2223 t.timestamps
2324 end
  
140140 create_table :source_importations do |t|
141141 t.references :source
142142 t.references :importation, :polymorphic => true
143 t.references :uri
143144 t.string :guid
144145 t.timestamps
145146 end