Sha256: 0bd4f429d51d5da7f05ce74097fa21279962e0cc88febeaf2f102533631dfdcc
Contents?: true
Size: 946 Bytes
Versions: 1
Compression:
Stored size: 946 Bytes
Contents
module RefinerycmsVimeoVideos module ActiveRecordExtension def self.included(base) base.extend(ClassMethods) end module ClassMethods def vimeo_video field class_eval <<-EOV def #{field} if self.new_record? self.#{field}_id else self.#{field}_id? ? VimeoMetaCache.find_or_create_by_vid(self.#{field}_id) : nil end end before_save :cache_vimeo_meta_for_#{field} def cache_vimeo_meta_for_#{field} if self.#{field}_id? and self.#{field}_id_changed? VimeoMetaCache.find_or_create_by_vid(self.#{field}_id) end end protected :cache_vimeo_meta_for_#{field} EOV end end end end ActiveRecord::Base.class_eval { include RefinerycmsVimeoVideos::ActiveRecordExtension }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
refinerycms-vimeo-videos-0.1.7 | lib/refinerycms_vimeo_videos/active_record_extension.rb |