activeadmin-plugins / active_admin_import

:paperclip: active_admin_import is based on activerecord-import gem - the most efficient way to import for ActiveAdmin
http://activeadmin-plugins.github.io/active_admin_import
MIT License
183 stars 101 forks source link

Add validate_uniqueness to README.md #181

Closed ypresto closed 4 years ago

ypresto commented 4 years ago

(NOTE: This is false by default in activerecord-import)

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 97.956% when pulling f67ba6767632097d1d45882db327579dea2e8b02 on ypresto:patch-1 into 07cee9c1163868c60250040e55aa7bb9571e4ec4 on activeadmin-plugins:master.

ypresto commented 4 years ago

Ah, it is not changeable option.

ypresto commented 4 years ago

I should disable it because my non-primary column has both presence and uniqueness validator.

ypresto commented 4 years ago

Finally I decided to prohibit id column in input csv.

before_batch_import: ->(importer) do
  # https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html
  raise 'Cannot specify id. Use subdomain for update key.' if importer.headers.keys.include?('id')