0
Meine Modelle aussehen: Show reflektieren ProjektseiteWie kann ich auf meiner Show-Seite auf das zusätzliche Attribut in der Join-Tabelle zugreifen?
class Project < ApplicationRecord
has_many :comments
has_many :contractor_projects
has_many :contractors, through: :contractor_projects
validates_presence_of :title, :contract_number, :category, :project_start_date, :project_end_date, :substantial_completion_date, :category, :solicitation_number, :project_officer, :location
accepts_nested_attributes_for :contractor_projects
end
class Contractor < ApplicationRecord
has_many :contractor_projects
has_many :projects, through: :contractor_projects
validates :name, presence: true
validates :email, presence: true, uniqueness: true
end
class ContractorProject < ApplicationRecord
belongs_to :contractor
belongs_to :project
end
Das ContractorProject
Modell verfügt über ein zusätzliches Attribut #bid_status, die ich will, aber es scheint nicht, obwohl es in dem params ist, wenn ich es angehoben.
Sie können mehr als eine Datensätze erhalten kann nicht bauen Ihr Projektmodell mit einem Attribut aus einer anderen Tabelle darin. In Ihrer Tabelle "ContractorProject" hat jede Assoziation einen eindeutigen "bid_status"? – Aschen
Könnten Sie bitte die Show-Ansicht und den Controller teilen? – Gerry