Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Updated the Readme #2417

Merged
merged 3 commits into from
Jan 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ end

### Migrations


Assuming you have a `users` table, add an `avatar` column to the `users` table:
```ruby
class AddAvatarColumnsToUsers < ActiveRecord::Migration
def up
Expand All @@ -221,10 +223,11 @@ end
(Or you can use the Rails migration generator: `rails generate paperclip user avatar`)

### Edit and New Views

Make sure you have corresponding methods in your controller:
```erb
<%= form_for @user, url: users_path, html: { multipart: true } do |form| %>
<%= form.file_field :avatar %>
<%= form.submit %>
<% end %>
```

Expand All @@ -233,6 +236,7 @@ end
```erb
<%= simple_form_for @user, url: users_path do |form| %>
<%= form.input :avatar, as: :file %>
<%= form.submit %>
<% end %>
```

Expand All @@ -254,7 +258,7 @@ end
```

### View Helpers

Add these to the view where you want your images displayed:
```erb
<%= image_tag @user.avatar.url %>
<%= image_tag @user.avatar.url(:medium) %>
Expand Down