Module: ActsAsAssets::UniqueAsset::InstanceMethods

Defined in:
lib/acts_as_assets/unique_asset.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_assets_check_uniqnessObject



9
10
11
12
13
14
# File 'lib/acts_as_assets/unique_asset.rb', line 9

def acts_as_assets_check_uniqness
  obj = self.class.send("find_by_#{self.class.foreign_key_name}".to_sym, self.send(self.class.foreign_key_name.to_sym))
  if obj
    errors.add(self.type, I18n.translate('acts_as_assets.unique_asset_error'))
  end
end

#multiple?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/acts_as_assets/unique_asset.rb', line 16

def multiple?
  false
end