rails 3.1 - jquery plugin for ajax upload

623 Views Asked by At

I want to install plugin for ajax upload in Rails 3.1.

How to do that? Just execute git clone in vendor/?

What about asset pipeline? I must specify some code like that in application.js?

//= require vendor/file-upload

Do you know better plugin for ajax file upload, than this one?

https://github.com/valums/file-uploader

UPDATE

I want to upload file without clicking submit, so remotipart doesnt apply to that.

1

There are 1 best solutions below

2
On

Instead of installing plugins under ./vendor (that's the old Rails way), you should look for a GEM which does the functionality, and add the Gem to the Gemfile, then run bundle install.

e.g. add this to your ./Gemfile :

gem 'name_of_the_gem' , "version_number"  # the version_number is optional

then run bundle install

There are a couple of gems available for file-uploading, some of them support AJAX. e.g.:


Plugin Installation on Rails 3:

$ rails plugin install http://wherever.com/somewhere/plugin_name.git

or

cd vendor/plugins

git clone -q http://wherever.com/somewhere/plugin_name.git

or

git submodule add http://wherever.com/somewhere/plugin_name.git vendor/plugins/plugin_name