concept file in category rails

This is an excerpt from Manning's book Rails 4 in Action: Revised Edition of Rails 3 in Action.
Ruby on Rails allows for the rapid development of applications by using a concept known as convention over configuration. A new Ruby on Rails application is created by running the application generator, which creates a standard directory structure and the files that act as a base for every Ruby on Rails application. These files and directories provide categorization for pieces of your code, such as the app/models directory for containing files that interact with the database and the app/assets directory for assets such as stylesheets, JavaScript files, and images. Because all of this is already there, you won’t be spending your time configuring the way your application is laid out. It’s done for you.
Requests to files from the public directory are handled by the server rather than by Rails, and anybody who enters the URL in their browser can access them. This is bad because the files in a project should be visible only to authorized users. You’ll handle that problem later in the chapter.
Under the filename, you display the size of the file, which is stored in the database as the number of bytes. To convert it to a human-readable output, (such as “71 Bytes,” which will be displayed for your file), you use the number_to_human_size view helper.
You first need to write a scenario to make sure the functionality works. This scenario will show you how to deal with file uploads when creating a ticket. Users should be able to create a ticket, and then select a file and upload it. Then they should be able to see this file, along with the other ticket details, on the ticket’s page. They may choose to click the filename, which would download the file.
Try running this feature using bundle exec rspec spec/features/creating_tickets _spec.rb and see how far you get. It fails on the attach_file line because the File field isn’t available yet:
1) Users can create new tickets with an attachment Failure/Error: attach_file "File", "spec/fixtures/speed.txt" Capybara::ElementNotFound: Unable to find file field "File"Add the File field to the ticket form partial directly under the <%= f.input :description %> field, using the code in the following listing.
You call this field attachment internally, but the user will see “File.” We’ve used attachment rather than file for naming because there’s already a File class in Ruby. Attachment is a good alternative, and it describes well what you’re doing—adding attachments to a ticket.

This is an excerpt from Manning's book Rails 3 in Action.
Ruby on Rails allows for rapid development of applications by using a concept known as convention over configuration. When you begin writing a Ruby on Rails application, you run an application generator, which creates a basic skeleton of directories and files for your application. These files and directories provide categorization for pieces of your code, such as the app/models directory for containing files that interact with the database and the public/images directory for images. Because all of this is already there for you, you won’t be spending your time configuring the way your application is laid out. It’s done for you.
Requests to files from the public directory are handled by the server rather than by Rails, and anybody who enters the URL in their browser can access them. This is bad because the files in a project should be visible only to authorized users. You’ll handle that problem a little later in the chapter.
Underneath the filename, you display the size of the file, which is stored in the database as the number of bytes. To convert it to a human-readable output (such as “71 Bytes,” which will be displayed for your file), you use the number_to_human_size Action View helper.
With the file’s information now being output in app/views/tickets/show.html.erb, this feature passes when you run bin/cucumber features/creating_tickets.feature:
You first need to write a scenario to make sure the functionality works. This scenario shows you how to deal with file uploads when creating a ticket. Users should be able to create a ticket, select a file, and upload it. Then they should be able see this file, along with the other ticket details, on the ticket’s page. They may choose to click the filename, which would download the file. Let’s test all this by adding a scenario at the bottom of features/creating_tickets.feature that creates a ticket with an attachment,[2] as shown in the following listing.
And I attach the file "spec/fixtures/speed.txt" to "File" cannot attach file, no file field with id, name, or label 'File' found (Capybara::ElementNotFound)