6
Rails 4.1 app. Sono in grado di lavorare intorno ad esso, ma interessato al perché non funziona:La relazione di Rails fixture non esiste
class NotificationSettings < ActiveRecord::Base
belongs_to :user
end
class User < ActiveRecord::Base
has_one :notification_settings
end
Questo non funziona:
# test/fixtures/notification_settings.yml
wilmas_notification_settings:
user: wilma
checkin_comments: false
checkin_comments_schedule: instant
Questo funziona: puntare
# test/fixtures/notification_settings.yml
wilmas_notification_settings:
user_id: wilma
checkin_comments: false
checkin_comments_schedule: instant
Tutte le cose essendo un problema con lo belongs_to
, ma sono sconcertato.
errore è:
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')
Sei in grado di espandere questa risposta in merito a questo è un bug in Rails 4? Se sì, dovrei comunque apportare le modifiche anche se attualmente non utilizzo le regole di flesso? Nel codice predefinito dice "Queste regole di inflessione sono supportate ma non abilitate di default" Grazie. – Marklar
Non penso che sia un bug. Penso che fosse solo in relazione al fatto che il plurale in questo caso era la stessa parola del singolare, a causa del has_one. – brandonhilkert