Skip to content
Browse files

Date stamp phrases last_access_at to ease keys cleanup from the console.

  • Loading branch information...
1 parent 980ee1e commit e663af66f2cf1a48e001d22902d18b3d2edfb397 @unixcharles committed
Showing with 12 additions and 0 deletions.
  1. +1 −0 app/models/refinery/copywriting/phrase.rb
  2. +11 −0 db/migrate/5_add_phrase_last_access_at.rb
View
1 app/models/refinery/copywriting/phrase.rb
@@ -19,6 +19,7 @@ def self.for(name, options = {})
phrase = self.find_by_name_and_page_id(options[:name], options[:page_id]) || self.create(options)
phrase.update_attributes(options.except(:value, :page, :page_id, :locale))
+ phrase.last_access_at = Date.today
phrase.save if phrase.changed?
phrase.default_or_value
View
11 db/migrate/5_add_phrase_last_access_at.rb
@@ -0,0 +1,11 @@
+class AddPhraseLastAccessAt < ActiveRecord::Migration
+
+ def self.up
+ add_column Refinery::Copywriting::Phrase.table_name, :last_access_at, :date
+ end
+
+ def self.down
+ remove_column Refinery::Copywriting::Phrase.table_name, :last_access_at
+ end
+
+end

0 comments on commit e663af6

Please sign in to comment.
Something went wrong with that request. Please try again.