placement.rb
has_one :client
has_one :case_manager
client.rb
belongs_to :case_manager
has_many :placements
case_manager.rb
has_many :clients
has_many :placements
I am trying to create a view file for placements.
I can pull columns from clients table in this view by using…
<%= @placement.client.wholename %>
but if I use
<% @placement.case_manager.wholename %>
I get error…
RuntimeError: ERROR C42703 Mcolumn case_managers.placement_id does
not exist Fparse_func.c L1359 Runknown_attribute: SELECT * FROM
case_managers WHERE (case_managers.placement_id = 4) LIMIT 1
which makes sense in that I don’t have a ‘placement_id’ column in
case_managers table. But case manager has many placments so I did create
a join table - case_managers_placements in which there are 2 fields…
placement_id
case_manager_id
and foreign keys for both fields to their respective tables
then I inserted 1 record, for the placement with the proper placement_id
and case_manager_id for the join…
I still get the above error.
How does one work through this situation?
Craig