arel_table rails

# Step 1: Import the necessary modules
require 'active_record'
require 'arel'

# Step 2: Define a class that inherits from ActiveRecord::Base
class YourModel < ActiveRecord::Base
end

# Step 3: Create an instance of Arel::Table for the corresponding database table
table = YourModel.arel_table

# Step 4: Use the created Arel::Table instance to build queries
query = table
  .project(table[Arel.star])
  .where(table[:column_name].eq('some_value'))
  .order(table[:another_column].desc)
  .take(10)

# Step 5: Execute the query and retrieve the results
result = YourModel.find_by_sql(query.to_sql)