I use Ruby on Rails and have to create a view that allows you to create entries through a HABTM relationship to another model. In particular, I have the following models: Customer and ServiceOverride, as well as the customers_serviceoverrides connection table. Using the client view to create / update, I need to be able to create, update and delete ServiceOverrides and manage the attributes of related models (s) from the same view.
Visually, I would prefer to have something like a plus / minus sign to add / remove service overrides, and each record of an overoverride service has two string objects that should also be displayed and edited. However, if I could just get the code (kind of nested form, I guess?), While working, I could develop aspects of the user interface.
The models are pretty simple:
class ServiceOverride < ActiveRecord::Base
has_and_belongs_to_many :customers
end
class Customer < ActiveRecord::Base
has_and_belongs_to_many :serviceoverrides
end
The closest thing that I found explaining this online in this blog , but in fact it does not affect what I am trying (how to manage connections with another model, and edit the attributes of this model.
Any help is appreciated. Thanks in advance.
Chris
source
share