# Creating tables with "variable" field names

**URL:** <https://www.ruby-forum.com/t/creating-tables-with-variable-field-names/130300>\
**Category:** Ruby\
**Created:** [February 27, 2008, 5:59am UTC](https://www.ruby-forum.com/t/creating-tables-with-variable-field-names/130300 "2008-02-27T05:59:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kretch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/db5fbb/32.png) [@kretch](https://www.ruby-forum.com/u/kretch)\
**Post date:** [February 27, 2008, 5:59am UTC](https://www.ruby-forum.com/t/creating-tables-with-variable-field-names/130300/1 "2008-02-27T05:59:11Z")

</div>

Hi All  
I’m slowly ramping up on Ruby (Ex-PERL’y), and have the following  
question:  
\*) I’d like to create a table , but with column names which are not  
fixed. So instead of doing

`
def self.up
    create_table mytable do |t|
       t.column :field1, :string
      t.column :field2, :stringI'd like to do
`

I’d like to do

`
var1 = "field1"
var2 = "field2"
def self.up
    create_table mytable do |t|
       t.column $var1, :string
      t.column $var2, :stringWhat is the correct syntax for doing that?
` Best Regards Kretch
