Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Post < ApplicationRecord
- has_one_attached :image
- end
- def post_params
- params.require(:post).permit(:title, :content, :image)
- end
- <div class="field">
- <%= form.label :image %>
- <%= form.file_field :image %>
- </div>
Add Comment
Please, Sign In to add comment