我在 rails g model 后,发现忘记写了一个属性,是不是要把之前的全部删掉,重新执行一次呢?
rails s model, 没有这个命令。忘记漏写当然不需要了重写了,你只要 rails g migration add_your_field_to_model 就可以了
#1 楼 @hanluner rails g migration event capacity:integer SECURITY WARNING: No secret option provided to Rack::Session::Cookie. This poses a security threat. It is strongly recommended that you provide a secret to prevent exploits that may be possible from crafted cookies. This will not be supported in future versions of Rack, and future versions will even invalidate your existing user cookies.
Called from: /usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.7/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'.
invoke active_record create db/migrate/20131108072054_event.rb 这样是不是可以了?谢谢,那个是 g ,手误
少写了就建立个 migration,rails g migration add__to** ,然后再 change 里面写上 add_column: :tables_name , :column_name , :data_type
#7 楼 @shangrenzhidao 你没有明白我的意思,以及那个谁的意思。看一下 rails guide 吧 http://guides.rubyonrails.org/migrations.html#creating-a-migration