bundle install
.config/environment.rb
, add this line to the end:rails server
.:avatar
should be the column you created, and AvatarUploader
should be whatever you generated.<input type="file">
in our form to handle the upload. If you already have a type="text"
input, change it; or if you don't, add a new one:If you are customizing a Devise form, it would instead look like<%= f.file_field :avatar, :class => "form-control" %>
.
<form>
tag itself to allow files to be uploaded by adding the enctype="multipart/form-data"
attribute:If you are customizing a Devise form, it would instead look like<%= form_for(resource, as: resource_name, url: registration_path(resource_name), :html => { :multipart => true }) do |f| %>
.
If you are customizing a Devise form, you'll have to instead allow this additional parameter through security.
public
folder, so that you can use it just like any other URL on the internet..env
filedotenv
, you can create a file called .env
in the root folder of your app. Then add the following content to the .env
file, replacing your information as needed:cloudinary.rb
in config/initializers
and add the following content: