Hey all,
This here is not working:
task(:load_selected => :load_config) do IgnoreTables = %w('students') begin ActiveRecord::Base.establish_connection ActiveRecord::Base.connection.tables.each do |table| if IgnoreTables.include? table puts "Its true" next else ActiveRecord::Base.connection.execute("TRUNCATE #{table}") end
end end end
Despite that some point table will be equal to students and students is in the IgnoreTables array, it should skip to the next iteration, but rather the else is triggered and the table is truncated.
Anyway know how to address this? Is there a method part of connection that will help me achieve what I am trying to do?
Thanks for response