I m building an app, in which i m populating database using sql dump file (<<*.sql).
I want model validation false while inserting data from Sql File.
How can it be possible?
Ex..
User_table
Name | Email
user_table << users.sql
user.rb(model)
validate_presence_of :email
want to do all model validation false while i insert data from sql file.
If you’re loading data from an SQL file (e.g. using something like
mysql < dump.sqlat the command line) then your validations won’t apply. The validations only apply if you’re using ActiveRecord (e.g. using a Ruby script that callssaveon an instance of theUsermodel).If you find that you can’t load your data without using ActiveRecord then the problem is probably your database schema not allowing
NULLvalues in certain columns.