Help escaping column name in a migration file

My DB column is name “3gp”, but the below is invalid syntax. How can i
express this in ruby?

class CreateVideos < ActiveRecord::Migration
def self.up
create_table :videos do |t|
t.column :x, :integer
t.column :y, :integer
t.column :max_time, :integer
t.column :max_file, :integer
t.column :mp4, :integer
t.column :3gp, :integer //how do this?
end
end

def self.down
drop_table :videos
end
end

class CreateVideos < ActiveRecord::Migration
def self.up
create_table :videos do |t|
t.column :x, :integer
t.column :y, :integer
t.column :max_time, :integer
t.column :max_file, :integer
t.column :mp4, :integer
t.column :3gp, :integer //how do this?
end
end

 t.column '3gp', :integer

or perhaps you could use a different name

On Aug 20, 2007, at 8:19 PM, eggie5 wrote:

  t.column :3gp, :integer //how do this?

I know it’s not the most natural sounding thing in the world but is
it heresy in Rails to just name it something like :video3gp
or :format3gp instead of :3gp?

  • Cliff

I would use your later suggestion as rails will attempt to create
accessor / mutator methods for this column, and method names can not
start with a number.

Cliff P. wrote:

  • Cliff


Sincerely,

William P.