title: What is the correct way to add_index in Rails?
body: <pre><code>add_index :section_edits, ['admin_user_id', 'section_id' ]
  </code></pre>
  
  <p>add_index :sections, [:name, :page_id]</p>
  
  <p>I know the variables are different, but my question is regarding how to pass the variables (i.e. :page_id vs 'page_id'). Does it makes a difference? Which one is better?</p>
  
  <p>I have noted that when I use :name it is already defined before I pass the variable, but if I use 'section_id' , following a tutorial, this variable was not previously defined.</p>
  
  <p>Here is some sample code:</p>
  
  <pre><code>class CreateSections &lt; ActiveRecord::Migration
    def change
      create_table :sections do |t|
  
        t.references :page
        t.string :name
        t.string :content_type
        t.integer :position
        t.boolean :visible
        t.text :content
  
        t.timestamps
      end
      add_index :sections, [:name, :page_id]
    end
  end   
  
  class CreateSectionEdits &lt; ActiveRecord::Migration
    def change
      create_table :section_edits do |t|
        t.references :admin_user
        t.references :section
  
        t.timestamps
      end
  
      add_index :section_edits, ['admin_user_id', 'section_id' ]
    end
  end
  </code></pre>
  
  <p>Thank you!</p>