Skip to content

Commit

Permalink
[#700] complain about useless :unique => true declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
al2o3cr committed Sep 21, 2011
1 parent aceb7af commit bbe3ac5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hobo_fields/lib/hobo_fields/model.rb
Expand Up @@ -170,7 +170,11 @@ def self.add_formatting_for_field(name, type, args)

def self.add_index_for_field(name, args, options)
to_name = options.delete(:index)
return unless to_name
unless to_name
# passing :unique => true doesn't do anything without an index
Rails.logger.error('ERROR: passing :unique => true without :index => true does nothing. Use :unique instead.') if options[:unique]
return
end
index_opts = {}
index_opts[:unique] = :unique.in?(args) || options.delete(:unique)
# support :index => true declaration
Expand Down

0 comments on commit bbe3ac5

Please sign in to comment.