Question: I have 3 models one

```
Customer               Book                 Book_Managers
id                     id                   id
first                  description          customer_id
last                   book_manager_id      visible
email                   
password                 

```

When the customer goes at customer#edit it then render the form books and book\_managers into one form

In my bookController I have the following to create a book and book\_manager

```
class BooksController < ApplicationController
    def create
        @customer = current_customer
        @book = @customer.book_managers.build(:visible => "true")
        @book = @customer.book_managers.first.books.build(:description => "2012")
    end
end

```

But then it tell me there is missing template. I am also only using a simple form\_for. What i am doing wrong? I believe I should be using accepts\_nested\_attributes\_for but any one has a good tutorial for this??

Update: In regard to the railcasts here my relationship and see if it make sense?

```
Customer
    has_many :book_managers
        has_many :books, :through => :book_managers
    accepts_nested_attributes_for :book_manager
Book
    belongs_to :book_manager
    def customer
        book_manager.customer
    end
Book_Manager
    belongs_to :customer
    has_many :books
    accepts_nested_attributes_for :book

```

Answer: 
I don't know exactly what you're trying to achieve and whether it is the best solution, but to me this sounds like a good use for the strategy pattern:

```
// This is the 'strategy' in your case
public interface IInteraction
{
    void Do();
}

public class GameObject
{
    // Here is your list of interactions - you can do whatever you want with it.
    public List<IInteraction> Interactions { get; set; }
}

// Here is an interaction
public class Shake : IInteraction
{
    public void Do()
    {
        ....
    }
}

```
One approach to this would be to have each action defined as a MonoBehavior script of their own. Then all you need to do is attach each behavior to each game object as a component.

This would require you changing your pattern of having all the actions defined in another class, but should keep things pretty clean.

Then to do each action you could just check if that gameobject has that component and do its action.
`Shake s = gameObject.GetComponent<Shake>();  

 if(s != null)  

 {  

 s.Shake(shakeParameters);  

 }`