rails active record to fetch only list of ids

# Fetch only the list of IDs using Rails ActiveRecord
id_list = Model.pluck(:id)

Explanation for each step: 1. Model: Replace this with the name of the ActiveRecord model you want to retrieve IDs from. 2. .pluck(:id): This method is used in Rails ActiveRecord to fetch only specific columns from the database. In this case, :id refers to the column name 'id' of the specified model. It retrieves an array containing only the values from the 'id' column of the database table associated with the model. This is more efficient than fetching the entire record when you only need the IDs. The result will be stored in the id_list variable as an array of IDs.