File Uploading using Paper clip Rails Plugin

This is one of the most useful plug (Rails Plugin) in that can be used in your application when you require to upload a file as attachment to your application, its quite easy to use and with the help of paperclip scaffolding you can achieve file upload feature very easily, below i have explained the steps to create a simple application using scaffolding that enables the file upload feature with the help of paperclip plugin.

Steps: Install the required gems to run the paperclip plugin from the below mentioned command, $ gem sources -a http://gemcutter.org http://gemcutter.org added to sources $ sudo gem install view_mapper Successfully installed view_mapper-0.2.0 1 gem installed Installing ri documentation for view_mapper-0.2.0... Installing RDoc documentation for view_mapper-0.2.0...

1. First you need to create a rails app and change the database.yml setting and set things to install the plug in $rails student -d mysql

2 Then you have to just install the paperclip plugin into your application from the below mentioned command, $ ./script/plugin install git://github.com/thoughtbot/paperclip.git 3. Once the plugin is installed, let me show you to create a simple scaffold with paperclip file attachment feature in it. Just create a simple scaffold and check it out, $ ./script/generate scaffold_for_view Student name:string branch:string comment:string --view paperclip:photo Then you need to enter $ rake db:create and $ rake db:migrate This will create the paperclip file attachment feature, just run $ script/server and check it out. The display looks just like the image i have mentioned at the beginning.

Get in touch with us.

Subscribe For Latest Updates

Related Posts

Leave a Comment

Your email address will not be published. Required fields are marked *

en_USEnglish