Permalink
Browse files

Ignore errors on load to allow migration

  • Loading branch information...
1 parent dda319f commit bd15d674ebf36f9f12e57d51b97d35f1fbbbd5b7 Ariel Salomon committed with sideshowbandana Sep 18, 2011
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/vanity/adapters/active_record_adapter.rb
@@ -148,10 +148,14 @@ def destroy_metric(metric)
# Store when experiment was created (do not write over existing value).
def set_experiment_created_at(experiment, time)
- record = VanityExperiment.find_by_experiment_id(experiment.to_s) ||
- VanityExperiment.new(:experiment_id => experiment.to_s)
- record.created_at ||= time
- record.save
+ begin
+ record = VanityExperiment.find_by_experiment_id(experiment.to_s) ||
+ VanityExperiment.new(:experiment_id => experiment.to_s)
+ record.created_at ||= time
+ record.save
+ rescue Exception => e
+ puts "Make sure Vanity migrations have been run, ignoring #{e}"
+ end
end
# Return when experiment was created.

0 comments on commit bd15d67

Please sign in to comment.