Create a 3 model relation in Rails
===

I am not sure how to create an event at all time but still keeping data integrite correct.
Here are my models

Customer

      id
      first
      last
      email

Book

      id
      description

Book_Manager

      customer_id
      book_id
      visible

In order to do this I have to use a has_many relationship and his describe has below

    Book
    	has_many :books, :through => :book_managers
    	has_many :book_managers
    Book_Manager
    	has_many :books, :through => :book_managers
    	has_many :book_managers
    Customer
    	belongs_to :customer
    	belongs_to :book

The idea is to see the data already created from previous time, which mean I would have to create a query where Book = Book_Manager Table where customer_id = current_customer and created_last. I am not to sure how would i create a query like this in the book controllers.

Last but not least, everytime the customer modify the text by pressing save, The action create would be executed, and create a new book_manager with the new book_id and book_description.

I have the following code but i am not sure if its correct

    class BooksController < ApplicationController
    	def edit
    		@book = Book.find(params[:id])
    	end
    
    	def create
    		@customer = Customer.first
    		@book = @customer.BookManager.build(params[:book])
    	end
    end