File: translation_text.rb

package info (click to toggle)
ruby-fast-gettext 0.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 692 kB
  • ctags: 254
  • sloc: ruby: 2,838; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 468 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require "protected_attributes" if ActiveRecord::VERSION::MAJOR >= 4

class TranslationText < ActiveRecord::Base
  belongs_to :translation_key, :class_name => 'TranslationKey'
  validates_presence_of :locale
  validates_uniqueness_of :locale, :scope=>:translation_key_id
  attr_accessible :text, :locale, :translation_key, :translation_key_id
  after_update :expire_cache

  protected

  def expire_cache
    FastGettext.expire_cache_for(translation_key.key)
  end
end