2016-03-27 18 views
0

(NameError):続編移行:初期化されていない定数Jsonb私は<a href="http://padrinorb.com/" rel="nofollow">Padrino</a>と<a href="https://github.com/jeremyevans/sequel" rel="nofollow">Sequel</a>を使用していて、次の移行が<code>uninitialized constant Jsonb (NameError)</code>エラーが発生した

Sequel.migration do 
    up do 
    alter_table :same_table do 
     add_column :not_working, Jsonb 
    end 
    end 
end 

問題なくJsonb使用販売テーブルのcreate_table移行:

Sequel.migration do 
    up do 
    create_table :same_table do 
     Jsonb :worked 
    end 
    end 
end 

答えて

1

Sequel source codeのように、列の種類を大文字にしないでください。一般に、DSLは定数ではなくクラスメソッドを定義することに関するものです。

Sequel.migration do 
    up do 
    alter_table :same_table do 
    #       ⇓⇓ NOTE SYMBOL  
     add_column :not_working, :jsonb 
    end 
    end 
end 

Sequel.migration do 
    up do 
    create_table :same_table do 
    # ⇓ NOTE DOWNCASE 
     jsonb :worked 
    end 
    end 
end 
関連する問題

 関連する問題