Rails activerecord


#1

i found model allway query this sql:

SHOW FIELDS FROM test_table

if my code needn’t know table structure, how to remove it?


#2

Joe B. wrote:

i found model allway query this sql:

SHOW FIELDS FROM test_table

if my code needn’t know table structure, how to remove it?

ActiveRecord makes these queries to enable it to reflect your table
structure in your model.

In development, it keeps making these queries so that if you change the
schema, the application will stay in line. In production it only reads
the structure of each table once after application start.

regards

Justin