Q:

Rails unpermitted parameters files when uploading using carrierwave

I am trying to upload using carrierwave but I am facing an error ..when i select the file and click on upload still it says it can't be blank and on console it says unpermitted parameters files .
[upload_controller.rb]
class UploadsController < ApplicationController
  before_action :authenticate_user! 

  def index
    @uploads=Upload.all
  end

  def new
    @upload=Upload.new
  end

  def create

    @upload=Upload.new(params_abc)

     if  @upload.save
        Upload.upload(params[:upload][:files])  
        redirect_to  @upload
     else
       render 'new'
     end

  end

private

  def params_abc
        params.require(:upload).permit(:title,:description)
  end

end

[upload.rb]

class Upload < ActiveRecord::Base

    validates :description,  presence: true
    validates :title,  presence: true
    validates :tageline, presence: true

    mount_uploader :upload, UploadUploader 

    def self.upload(files)  
        files.each do |file|    
        #@file_extension=file.content_type.split('/')[1]            

            doc = Upload.new(tageline: file )
            #save is a method which will save the content in the database 
            doc.save!
        end
    end

end

[uploads/new.html.erb]

<%= form_for @upload,html: { multipart: true } do |f| %>
    <% if @upload.errors.any? %>
        <div id="errors">
            <h2><%= pluralize(@upload.errors.count, "error") %> prevented this post from saving:</h2>
            <ul>
                <% @upload.errors.full_messages.each do |msg| %>
                    <li><%= msg %></li>
                <% end %>
            </ul>
        </div>
    <% end %>

    <%= f.label :title %><br>
    <%= f.text_field :title %><br>
    <br>

    <%= f.label :description %><br>
    <%= f.text_field :description %><br>

     <br>

    <%= f.label :files %><br>
    <%= f.file_field :files%><br>
    <br>

    <%= f.submit %>
<% end %>

[upload_migration]
class CreateUploads < ActiveRecord::Migration
  def change
    create_table :uploads do |t|
        t.string :title, null: false
        t.string :description, null: false
        t.string :tageline, null: false
        t.timestamps
    end
  end
end

[console]

Started POST "/uploads" for 127.0.0.1 at 2016-02-08 14:18:54 +0530
Processing by UploadsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"1YaRS4BPwg6W5RaKNs/BOCf24TezALQWuxEEhjz04nY=", "upload"=>{"title"=>"mjkhhjkkj", "description"=>"jhhjnh", "files"=>#<ActionDispatch::Http::UploadedFile:0x000000053ec6c8 @tempfile=#<Tempfile:/tmp/RackMultipart20160208-10624-40whhz>, @original_filename="Design Patterns in Ruby (2007).pdf", @content_type="application/pdf", @headers="Content-Disposition: form-data; name=\"upload[files]\"; filename=\"Design Patterns in Ruby (2007).pdf\"\r\nContent-Type: application/pdf\r\n">}, "commit"=>"Create Upload"}
  User Load (0.3ms)  SELECT  `users`.* FROM `users`  WHERE `users`.`id` = 4  ORDER BY `users`.`id` ASC LIMIT 1
Unpermitted parameters: files
   (0.1ms)  BEGIN
   (0.1ms)  ROLLBACK
  Rendered uploads/new.html.erb within layouts/application (2.7ms)
Completed 200 OK in 86ms (Views: 82.3ms | ActiveRecord: 0.5ms)

[tageline_uploader]

# encoding: utf-8

class TagelineUploader < CarrierWave::Uploader::Base

  # Include RMagick or MiniMagick support:
  # include CarrierWave::RMagick
  # include CarrierWave::MiniMagick

  # Choose what kind of storage to use for this uploader:
  storage :file
  # storage :fog

  # Override the directory where uploaded files will be stored.
  # This is a sensible default for uploaders that are meant to be mounted:
  def store_dir
    "uploadss/post/#{model.id}"  
  end

  # Provide a default URL as a default if there hasn't been a file uploaded:
  # def default_url
  #   # For Rails 3.1+ asset pipeline compatibility:
  #   # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
  #
  #   "/images/fallback/" + [version_name, "default.png"].compact.join('_')
  # end

  # Process files as they are uploaded:
  # process :scale => [200, 300]
  #
  # def scale(width, height)
  #   # do something
  # end

  # Create different versions of your uploaded files:
  # version :thumb do
  #   process :resize_to_fit => [50, 50]
  # end

  # Add a white list of extensions which are allowed to be uploaded.
  # For images you might use something like this:
  # def extension_white_list
  #   %w(jpg jpeg gif png)
  # end

  # Override the filename of the uploaded files:
  # Avoid using model.id or version_name here, see uploader/store.rb for details.
  # def filename
  #   "something.jpg" if original_filename
  # end

end

A:

You should add parameter :tageline to your params_abc method.
def params_abc
  params.require(:upload).permit(:tageline, :title, :description)
end

Also you need to add :tageline as upload field because you don't have :upload field in your database.
mount_uploader :tageline, UploadUploader

No need to have upload method in your model Upload and create new Upload object per each file, just remove it.
Also you should remove this line from controller:
Upload.upload(params[:upload][:files])

And change 
<%= f.label :tageline %><br>
<%= f.file_field :tageline %><br>

in your view

