0

is it possible to alter the database from within a Rails Application?

I am translating a Java routine that was executed every 3 hours to Rails which does the following: It reads data from a website. This data is stored in a temporary table in the database. After reading is finished, the table of the older data is dropped and the temporary table renamed.

Is it possible to do that with Ruby on Rails?

4

1 回答 1

0

可以执行任意sql:

ActiveRecord::Base.connection.execute("drop temp_table")
于 2013-07-08T22:29:56.127 回答