最佳答案
                                        
                                                                        
                                我需要添加时间戳(created_at和 updated_at)到一个现有的表。我试了下面的代码,但它不工作。
class AddTimestampsToUser < ActiveRecord::Migration
def change_table
add_timestamps(:users)
end
end
 
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                            