lib/lockbox/model.rb in lockbox-0.4.7 vs lib/lockbox/model.rb in lockbox-0.4.8

- old
+ new

@@ -25,9 +25,14 @@ raise ArgumentError, "Unknown type: #{options[:type]}" unless custom_type || [nil, :string, :boolean, :date, :datetime, :time, :integer, :float, :binary, :json, :hash, :array].include?(options[:type]) activerecord = defined?(ActiveRecord::Base) && self < ActiveRecord::Base raise ArgumentError, "Type not supported yet with Mongoid" if options[:type] && !activerecord + # TODO raise ArgumentError in 0.5.0 + warn "[lockbox] WARNING: No attributes specified" if attributes.empty? + + raise ArgumentError, "Cannot use key_attribute with multiple attributes" if options[:key_attribute] && attributes.size > 1 + attributes.each do |name| # add default options encrypted_attribute = "#{name}_ciphertext" options = options.dup