I was hoping someone would be able to help me with creating a method.
I have two tables. What I am trying to do is create a list of all the
from table2 that aren’t currently referenced by Table1’s address_id
That way, when I create a new customer I can have a drop down list in
view of all the addresses that are not currently being used.
class Table1 < ActiveRecord::Base
class Table2 < ActiveRecord::Base
@table2 = Table2.find_all # This is what I want to change
@table1 = Table1.new
<%= collection_select 'table1, ‘table2_id’, @table2, :id, :address -%>
I am very new to ruby and rails and know how to do easier searches, but
doing a search from two tables and matching the results is a little
me at this point.
If there is a different or better way to go about doing this, I am open
Any help would be greatly appreciated.