I am using Ruby on Rails 3 and I am trying to sow data in my application database.
In 'RAILS_ROOT / models / user.rb' I have:
class User < ActiveRecord::Base attr_accessible #none validates :name, :presence => true validates :surname, :presence => true validates :email, :presence => true end
In 'RAILS_ROOT / db / seeds.rb' I have:
# Test 1 User.find_or_create_by_email ( :name => "Test1 name", :surname => "Test1 surname", :email => " test1@test1.test1 " ) # Test2 User.find_or_create_by_email ( :name => "", :surname => "", :email => " test2@test2.test2 " )
So, working in the terminal
rake db:seed
Of course, the database will NOT be populated with data, because "attr_accessible" is for nil (Case Test1) and the verification failed (Case Test2).
I would like to skip the check and โattr-available effectsโ during the sowing process. Is it possible? If so, how to do it?
PS: I do not want to use the code 'RAILS_ROOT / db / migrate / 201 .... rb' as follows:
execute "INSERT INTO users ( name, surname, email ) VALUES ( "Test1 name", "Test1 surname", " test1@test1.test1 ")"
UPDATE
I need to also skip all callbacks. Is it possible? If so, how?