Module: ChromembedRails::Model::ModelClassMethods

Defined in:
lib/chromembed_rails/model.rb

Overview

Methods here become ActiveRecord::Base class methods.

Instance Method Summary collapse

Instance Method Details

#chrome_extension_cache_modelObject

Extends the model to cache data for serving an embedded Chrome extension.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/chromembed_rails/model.rb', line 23

def chrome_extension_cache_model
  # The extension's appid.
  validates :appid, :uniqueness => true, :length => 1..128, :presence => true

  # The extension version listed in manifest.json.
  validates :version, :length => { :in => 0..64, :allow_nil => false }
  
  # The CRX file contents.
  validates :crx_bits,
            :length => { :in => 0..(64.megabytes), :allow_nil => false }

  extend ModelMetaclassMethods
  include ModelInstanceMethods
end