Here's what I'm trying to do.
Create a view/model named Calls. It will list various pieces of data native to the table. The basic view (scaffold) I created does that via an instance variable in the controller. Now I want to bring a field from another table, in this case "units" into the view and allow the a field from units to be written to a field within calls upon submit.
call.rb:
class Call < ActiveRecord::Base
attr_accessible :call_nature, :caller_address, :caller_name, :caller_phone, :incident_number
validates :caller_name, :caller_phone, :caller_address, :presence => true
has_many :units
end
units.rb:
class Units < ActiveRecord::Base
attr_accessible :unit_name
belongs_to :call
end
So in essence I want to be able to display my call fields within a view or form but also want to be able to access Calls.unit_name and display it for selection in my form and view.
I've been reading up on associations and it seems very straight forward but I seem to be having a problem.
If you need more information, please let me know.