2016-09-26 7 views
0

Railsの移行から2つのテーブルを作成したばかりです。 1つはShippingLabel、もう1つはShippoというモデルです。移行は正常に実行され、Postgresにテーブルが正しく作成され、Shippoが定数として認識されるように見えます。しかし、ActiveRecord :: Baseから継承していないのは、Shippoのようなものです。RailsモデルがActiveRecord :: Baseから継承しない

shippo.rb

class Shippo < ActiveRecord::Base 
end 

shipping_label.rb

class ShippingLabel < ActiveRecord::Base 

    belongs_to :device_purchase 

end 

私はShippingLabel < ActiveRecord::Baseを実行して、私はtrueを取得します。コンソールにShippo < ActiveRecord::Baseを実行すると、私はnilになります。

+0

テーブル名は、Postgresの –

+0

で 'shippos'と' shipping_labels'あるあなたのレールコンソールをリロードしてみてください。 – Ilya

+0

@llya私は 'reload! 'を試して、何度もそれを終了しました、運はありません –

答えて

0

私は通常、オブジェクトのインスタンスでclass.superclassを使用してスーパークラスを判別します。 Railsのコンソールで

shippo = Shippo.new #shippo is an instance of the class Shippo 
shippo.class.superclass 
関連する問題