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

Commit

Permalink
Updated the Readme (#2417)
Browse files Browse the repository at this point in the history
* Updated the Readme, added a submit button to the form and made some notes to make instructions more clear
  • Loading branch information
CorinneKelly authored and sidraval committed Jan 30, 2018
1 parent 69056cd commit 1f0795f
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit 1f0795f

Please sign in to comment.