6
रेल 4.1 ऐप। मैं क्यों यह काम नहीं कर रहा है कि यह चारों ओर काम करने में सक्षम है, लेकिन में दिलचस्पी रखता हूँ:रेल स्थिरता संबंध मौजूद नहीं है
class NotificationSettings < ActiveRecord::Base
belongs_to :user
end
class User < ActiveRecord::Base
has_one :notification_settings
end
यह काम नहीं करता:
# test/fixtures/notification_settings.yml
wilmas_notification_settings:
user: wilma
checkin_comments: false
checkin_comments_schedule: instant
करता है काम:
# test/fixtures/notification_settings.yml
wilmas_notification_settings:
user_id: wilma
checkin_comments: false
checkin_comments_schedule: instant
सभी चीजों को इंगित belongs_to
के साथ समस्या होने के कारण, लेकिन मैं परेशान हूं।
त्रुटि है:
ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "user" of relation "notification_settings" does not exist
LINE 1: INSERT INTO "notification_settings" ("user", "checkin_commen...
^
: INSERT INTO "notification_settings" ("user", "checkin_comments", "checkin_comments_schedule") VALUES (550831404, 'f', 'instant')
क्या आप इस उत्तर पर रेल 4 में यह बग के संबंध में विस्तार करने में सक्षम हैं? यदि हां, तो क्या मुझे अभी भी परिवर्तन करने की आवश्यकता होगी भले ही मैं वर्तमान में इन्फ्लिक्शन नियमों का उपयोग नहीं कर रहा हूं? डिफ़ॉल्ट कोड में यह कहता है "ये इन्फ्लिक्शन नियम समर्थित हैं लेकिन डिफ़ॉल्ट रूप से सक्षम नहीं हैं" धन्यवाद। – Marklar
मुझे नहीं लगता कि यह एक बग है। मुझे लगता है कि यह सिर्फ इस तथ्य से संबंधित था कि इस मामले में बहुवचन एकवचन के समान शब्द था, has_one के कारण। – brandonhilkert