concept Paperclip in category rails

appears as: Paperclip
Rails 3 in Action

This is an excerpt from Manning's book Rails 3 in Action.

Once you’re familiar with Paperclip, you’ll change your application to accept multiple files attached to the same ticket using a JavaScript library called Prototype (which comes with Rails) and some custom JavaScript code of your own. Because you’re using JavaScript, you have to alter the way you test parts of your application. To test JavaScript functionality, you’ll be using WebDriver,[1] which is a framework built for automatic control of web browsers. WebDriver is especially useful because you can use the same steps you use for standard Cucumber and Capybara tests and because Capybara will take care of driving the browser. By running the tests inside the browser, you ensure the JavaScript on the page will be executed, and then you can run the tests on the results. Pretty handy!

These getter and setter methods are defined automatically by Active Model for the fields in your database. Paperclip wants the asset_file_name method defined on your Ticket instance’s method. asset_file_name is one of four methods used by Paperclip to track details about the file. The other methods are asset_content_type, asset_file_size, and asset_updated_at. To define the asset_file_name method and its siblings, create a migration that adds them as attributes of the Ticket model by running this command: