This should be quite simple, but I can’t work out the syntax.
I have an AR query
ActiveRecord::Base.connection.tables.select { |t| t != 'schema_migrations' }
that I want to add an OR statement to
ActiveRecord::Base.connection.tables.select { |t| t != 'schema_migrations' OR 'pg_search_documents' }
What is the correct syntax? Thanks!
The correct syntax is:
The code inside the block is just a Ruby expression that needs to return a boolean result so you can use the logical AND operator
&&to express the logic “table name is not ‘schema_migrations’ AND table name is not ‘pg_search_documents'”Perhaps a simpler way to express the same logic is to subtract an array of table names that you want to filter out like this: