Rails: CarrierWave file uploads

semantic web for web developer

CarrierWave bootstrapCarrierWave file uploads

Installing CarrierWavein your Gemfile

CarrierWave provides a generator called uploader to do this to which we pass the name we want to give our uploader, in this case image.

edit your show.html.erb which become

Next we’ll need to add the uploader to the Painting model.

Next we’ll add the uploader to the Painting model which is done by calling the mount_uploader method

and then in your app/views/paintings/_form.html.erb edit your code, which become

edit your show.html.erb which become

Uploading Image via URL
adding line in _form.html.erb

As we’ve added a field to the painting form we’ll need to add it to the list of attr_accessible fields in the Painting model

View original post

Advertisements