Dynamic database table

Just out of curiosity,

Is it possible with RoR (to be more exact - with ActiveRecord) to
create database table “on fly”, from the application?

Is it possible with RoR (to be more exact - with ActiveRecord) to
create database table “on fly”, from the application?

certainly, if the configured db login has create table privilege, then
just call following in your code.

ActiveRecord::Base.connection.create_table :table1 do |t|
t.column :name, :string
t.column :description, :string
end

but personally I never add drop table dynamically, sounds scary.

Dorren
http://groups.wuyaSea.com — blog, evolved.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs