title: Accessing virtual attribute from params
body: <pre><code>ruby 2.1.5
  rails 4.2.1
  </code></pre>
  
  <p>I am trying to figure out how to access a virtual attribute from params.</p>
  
  <p>In my books_controller.rb, I have:</p>
  
  <pre><code>wrap_parameters :books_list
  
  def product_params
    params.require(:product).permit(:author_name, :book_name, :books_list)
  end
  </code></pre>
  
  <p>Obviously, the books_list is the virtual attribute. I will be saving it to the books_list table</p>
  
  <p>In my new.html.erb,I have:</p>
  
  <pre><code>&lt;% @title = "Books" %&gt;
  
  &lt;div class="container"&gt;
    &lt;div class="row"&gt;
      &lt;div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"&gt;
        &lt;%= form_for(@books, html: { class: 'form-horizontal' }) do |f| %&gt;
            &lt;%= f.error_notification %&gt;
  
            &lt;div class="form-inputs"&gt;
              &lt;%= f.form_group :author_name do |f| %&gt;
                  &lt;%= f.label :author_name, class: 'control-label col-md-2' %&gt;
                  &lt;div class='col-md-8'&gt;
                    &lt;%= f.text_field :author_name, class: 'form-control' %&gt;
                    &lt;%= f.error_messages %&gt;
                  &lt;/div&gt;
              &lt;% end %&gt;
  
              &lt;div class="form-inputs"&gt;
                &lt;%= f.form_group :book_name do |f| %&gt;
                    &lt;%= f.label :book_name, class: 'control-label col-md-2' %&gt;
                    &lt;div class='col-md-8'&gt;
                      &lt;%= f.text_field :book_name, class: 'form-control' %&gt;
                      &lt;%= f.error_messages %&gt;
                    &lt;/div&gt;
                &lt;% end %&gt;
  
                &lt;%= f.form_group :books_list do |f| %&gt;
                    &lt;%= f.label :books_list, class: 'control-label col-md-2' %&gt;
                    &lt;div class='col-md-8'&gt;
                      &lt;%= f.text_area :books_list, class: 'form-control' %&gt;
                      &lt;%= f.error_messages %&gt;
                    &lt;/div&gt;
                &lt;% end %&gt;
  
            &lt;/div&gt;
  
            &lt;div class="form-actions col-md-offset-2 col-md-10"&gt;
              &lt;%= f.submit class: 'btn btn-primary' %&gt;
              &lt;%= link_to "Cancel", test_sets_path, class: 'btn' %&gt;
            &lt;/div&gt;
        &lt;% end %&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I submit the form, here's what I get for params:</p>
  
  <pre><code>Parameters: {
    "utf8"=&gt;"✓", 
    "authenticity_token"=&gt;"5mxkibQHkwRnzVU31A6pe9uezsmaWeYbCUgU+gUZPLmiAZPnN6si+smdEePU0lfGITh7gmmyChf/bOY+YQQcQg==", 
    "books"=&gt;{"author_name"=&gt;"Some Author", "book_name"=&gt;"Dwan Of The Dead"}, 
    "books_list"=&gt;{"{:class=&gt;\"form-control\"}"=&gt;"book1\r\nbook2"}, 
    "commit"=&gt;"Create Book List"
  }    
  </code></pre>
  
  <p>I am having trouble accessing the   books_list in params. Any ideas?</p>