lundi 21 décembre 2015

Rails Active Records SQLite3::SQLException: no such column: subs.subscriber_id: SELECT "subs".* FROM "subs" WHERE "subs"."subscriber_id" =?

I have Used Has_many relation to a Subscriber and Sub models

class Sub < ActiveRecord::Base

belongs_to :Subscriber end

class Subscriber < ActiveRecord::Base has_many :subs

end

While inserting record to Sub table bu sung << It is giving error as follows

Rails Console. a=Subscriber.find(1) Subscriber Load (0.0ms) SELECT "subscribers".* FROM "subscribers" WHERE "subscribers"."id" = ? LIMIT 1 [["id", 1]] => # irb(main):002:0> a.subs Sub Load (0.0ms) SELECT "subs".* FROM "subs" WHERE "subs"."subscriber_id" = ? [[nil, 1]] ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: subs.subscriber_id: SELECT "subs".* FROM "subs" WHERE "subs"."subscriber_id" = ?

Aucun commentaire:

Enregistrer un commentaire