Sha256: 934fb82a3054eec174f7cab19a1780017ece9b8d65f406f442d1b3a57f56e177
Contents?: true
Size: 551 Bytes
Versions: 2
Compression:
Stored size: 551 Bytes
Contents
# encoding: utf-8 class Asset include Mongoid::Document include Uploader::Asset belongs_to :assetable, polymorphic: true field :guid before_save do return true if self.assetable_id.nil? || !self.assetable_id.is_a?(String) if defined?(Moped::BSON) self.assetable_id = Moped::BSON::ObjectId.from_string(self.assetable_id) if Moped::BSON::ObjectId.legal?(self.assetable_id) else self.assetable_id = BSON::ObjectId.from_string(self.assetable_id) if BSON::ObjectId.legal?(self.assetable_id) end true end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
glebtv-rails-uploader-0.4.1 | spec/dummy/app/models/asset.rb |
glebtv-rails-uploader-0.4.0 | spec/dummy/app/models/asset.rb |