So far, I've not been able to find a solution that is able to allow a form to interact with two models that have a one-to-many relationship. Say for example, a customer has many items.
Currently, I've implemented solutions using Javascript that enables users to add/remove rows to the item list. Let's keep it simple, we're creating new r...
Banging my head against this one for a long time. On Rails 2.3.2, Ruby 1.9.1.
Trying to use one form to create three objects that have these relations:
class Person
has_one :goat
end
class Goat
belongs_to :person
has_many :kids
end
class Goat::Kid
belongs_to :goat
end
Here's a summary of the schema:
Person
first_name
l...
I'm developing a simple rails app for my own use for learning purposes and I'm trying to handle 2 models in 1 form. I've followed the example in chapter 13 of Advanced Rails Recipes and have got it working with a few simple modifications for my own purposes.
The 2 models I have are Invoice and InvoicePhoneNumber. Each Invoice can have s...
Hi
Just a quick question about best practice in MVC development.
Let's say that I've got two controllers (cont1, cont2), each of which uses a separate model, model1 & model2.
all files are complex, models contain dozens of methods.
Say, I finished developing of the first controller and I'm in the middle of work on the second one. I n...
I have a many-to-many relationship with a link box, and I want to pull those models together into one form so I can update from the same page. I'm really struggling with getting the check_box to even show all the elements of my array - I've scoured the net and been working on this literally all day, and I'm finding it difficult to apply ...
Hello everyone.
I have two models set up that I need to save inside one form. When the user uses the "/deliveries/add/" form, I need it to save a new delivery, and also save a new license that is attached to that delivery. This is a hasOne relationship.
Delivery belongsTo License
License hasOne Delivery
Also in the same form, I need...
I have a Company model and an Employee model and I want to create a Company and then create multiple employees for the company in one view.
How should I do this in the view?
And what should I do in the Create POST method to support this multi-entry view?
...
I have an Employee model that has a Name and Company
I want to be able to build multiple Employees in one CREATE view. I figured I need to create an IList<Employee> and do something like:
<%= Html.TextBoxFor(m => m[0].Name) %>
<%= Html.TextBoxFor(m => m[0].Company) %>
<%= Html.TextBoxFor(m => m[1].Name) %>
<%= Html.TextBoxFor(m => m[...