因此有2個相關分支。 通知和shipping_options。schema.rb中的Git數據庫更改
我檢查notifications
出master
,然後製成2點顯著數據庫的變化:通過增加一個布爾dismissed
然後shipping_options
- 創建
GeneralNotice
模型 - 改性現有
Notice
模型,也以與相同的狀態被檢出0,並且沒有進行數據庫更改,只有很小的代碼更改。我跑
rake db:migrate
第一次從notifications
切換到shipping_options
,反之亦然。此刻,當我在
notifications
,並運行rails c
我得到以下幾點:2.0.0-p451 :001 > Notice => Notice(id: integer, title: string, description: text, created_at: datetime, updated_at: datetime, kind: string, general_notice_id: integer, shop_id: integer, dismissed: boolean) 2.0.0-p451 :002 > GeneralNotice => GeneralNotice(id: integer, title: string, description: text, created_at: datetime, updated_at: datetime) 2.0.0-p451 :003 >
- 通知書
dismissed
(預期) - GeneralNotice存在(如預期)
然後我切換到
shipping_options
,我希望你一直關注,因爲這裏出現了令人困惑的部分...2.0.0-p451 :001 > Notice => Notice(id: integer, title: string, description: text, created_at: datetime, updated_at: datetime, kind: string, general_notice_id: integer, shop_id: integer, dismissed: boolean) 2.0.0-p451 :002 > GeneralNotice NameError: uninitialized constant GeneralNotice from (irb):2 from /Users/marcoprins/.rvm/gems/ruby-2.0.0-p451/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start' from /Users/marcoprins/.rvm/gems/ruby-2.0.0-p451/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start' from /Users/marcoprins/.rvm/gems/ruby-2.0.0-p451/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>' 2.0.0-p451 :003 >
GeneralNotice
不存在,那麼顯然是Git是是非常好,樂於助人的,根據我的分支更改數據庫Notice
仍然有一個布爾dismissed
... Whaaaat ??? ? git是不是很好?幫幫我!!!!!!
- 通知書
我在哪裏可以看到桌子,只是爲了確定。 'GeneralNotice.inspect'引發相同的未初始化的常量錯誤 –
登錄到數據庫控制檯。如果mysql:mysql -u -p 並且顯示錶; –