Custom table created using sql command

If I created a table using an sql command with ruby then how can I access the rows and columns using the active record methods?
right now I am using

Class.new(ActiveRecord::Base) do
        self.table_name = field.name
        #belongs_to :timetable_entry
      end

where field is the name of the table.

I used this command for creating the table.

 sql = "CREATE TABLE IF NOT EXISTS #{key}(id INTEGER PRIMARY KEY AUTOINCREMENT,name text(20),P_Id int,FOREIGN KEY (P_Id) REFERENCES TimetableEntry(id))"
                  ActiveRecord::Base.connection.execute(sql)

I want the users to create fields for the calendar on my website and then store list of values on that field.
For example field could be teachers. They could have field as professors.
And then store various names in that table.
I could not understand how to solve this problem so used dynamic tables.
If the field teachers is already there created by some other user then I don’t create a new teachers table.

Is there any other way I could solve this problem?