My requirements 
Basically I'm adding books to a database, and I want to store the Author in a separate table. So I have a table called authors which is referenced by the table books.

I want to create a rails form for adding a book, and I'd like it to be just a simple form for Author, Title, Publisher etc, and if it finds the author already in the authors table then it should just reference that record, and if it isn't in the authors table then it should add a new record and reference it.

while storing values i am getting in log file 
Unpermitted parameters: author

```
Processing by BooksController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"8sxeOVMVJucl5nN+kMpSaT1cB1yDPnk5gfKElWPiT5k=", "book"=>{"book_name"=>"life ", "price"=>"20", "author"=>{"author_name"=>"swamy", "title"=>"LIFE", "publisher"=>"cta"}}, "commit"=>"Submit"}

swamy
LIFE
cta
  Author Load (1.6ms)  SELECT  "authors".* FROM "authors"  WHERE "authors"."author_name" = 'swamy' AND "authors"."title" = 'LIFE' AND "authors"."publisher" = 'cta' LIMIT 1
   (0.6ms)  BEGIN
  SQL (25.2ms)  INSERT INTO "authors" ("author_name", "created_at", "publisher", "title", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"  [["author_name", "swamy"], ["created_at", "2015-07-01 03:53:22.712401"], ["publisher", "cta"], ["title", "LIFE"], ["updated_at", "2015-07-01 03:53:22.712401"]]
   (16.8ms)  COMMIT
Unpermitted parameters: author
   (0.7ms)  BEGIN
  SQL (1.0ms)  INSERT INTO "books" ("Author_id", "book_name", "created_at", "price", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"  [["Author_id", 8], ["book_name", "life "], ["created_at", "2015-07-01 03:53:22.865106"], ["price", 20], ["updated_at", "2015-07-01 03:53:22.865106"]]
   (22.4ms)  COMMIT

```

my code
books\_Controller

```
class BooksController < ApplicationController
  def new

  end
 def create

  @a=params[:author_name]
  puts @a
  b=params[:book][:author][:author_name]
  puts b
#   @c = @b.authors
#   @d = @c.author_name
   c=params[:book][:author][:title]
        d=params[:book][:author][:publisher]

  puts c
   puts d
   @author = Author.find_or_create_by(author_name: b,title: c, publisher: d)
   @book = Book.new(books_params)
   @book.Author = @author  
   @book.save 
  redirect_to root_url

 end
private

  def books_params
     params.require(:book).permit(:book_name, :price,:author_attributes => [:author_name, :title, :publisher])
end 
end 

```

model

```
class Author < ActiveRecord::Base

end

class Book < ActiveRecord::Base
  belongs_to :Author
  accepts_nested_attributes_for :Author
 # def author_name=(author_name)
  #  self.author = Author.find_or_create_by_name author_name
  #end
end

```

view
books.html.erb

```
<%= form_for Book.new  do |f| %>

  <p>
    <%= f.label :book_name %><br />
    <%= f.text_field :book_name %>
  </p>
  <p>
    <%= f.label :price %><br />
    <%= f.text_field :price %>
  </p>

  <%= f.fields_for :author do |b| %>
     <p>
    <%= b.label :author_name%><br />
    <%= b.text_field :author_name %>
  </p>
<p>
    <%= b.label :title%><br />
    <%= b.text_field :title %>
  </p>
<p>
    <%= b.label :publisher%><br />
    <%= b.text_field :publisher%>
  </p>

  <% end %>
  <p><%= f.submit "Submit" %></p>
<% end %>
~         

```

Hi sir i am new to rails i know it looks simple but i unable it find solution

~  

~