How to create new tables while running (automatically)

Hey guys

I’m new here, I hope, theres someone who can help me because I asked
question on a lot of different platforms on the internet and there was
noone who could give me a helpful answer.
My problem is actually very simple: I know there is the command “rails g
model” or rather “rails g migration” for changing or creating tables.
how can I let my controller AUTOMATICALLY create or change tables? Is
a ruby command that can create new tables such as “CREATE TABLE” in SQL?
I’m looking for an answer to this question for so long, if there is
who knows the answer, please write a comment.

Thank you for your time,


On 28 April 2013 12:31, Anton K. [email protected] wrote:

knows the answer, please write a comment.
Which bit don’t you know how to do? Run sql directly from Rails or
don’t you know the sql to create a table?


You can execute SQL statements in a rails application with the command:

ActiveRecord::Base.connection.execute(‘your sql’)