Как мне настроить paperclip/s3 для удобного мексиканского дивана?
Не получить никаких результатов в пользовательской модели в удобном приложении. У меня есть модель, в которой есть бэкэнд "Комфортный мексиканский диван", и она включает файл, который должен быть загружен в AWS. Там есть ведро, и я настроил различные пункты:
aws.yml:
development:
access_key_id: 'xxxxxxxxx'
secret_access_key: 'xxxxxxxxx'
development.rb:
config.paperclip_defaults = {
:storage => :s3,
:bucket => 'somerton'
}
модель (Drawing.rb):
has_attached_file :image
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
Я сгенерировал модель, используя генератор скрепок, и схема
schema.rb:
create_table "drawings", force: :cascade do |t|
t.string "url"
t.string "title"
t.string "description"
t.datetime "created_at"
t.datetime "updated_at"
t.string "image_file_name"
t.string "image_content_type"
t.integer "image_file_size"
t.datetime "image_updated_at"
end
Частичная форма была изменена для включения файлового ввода и состоит из нескольких частей:
_form.html.haml:
= form.text_field :url
= form.text_field :title
= form.text_field :description
= form.file_field :image
= form.form_group :class => 'form-actions' do
= form.submit :class => 'btn btn-primary'
Кто-нибудь видит очевидную проблему, по которой я скучаю? (да, гем установлен):
gem "paperclip", "~> 4.3" # uploads
gem 'aws-sdk' # allow use of aws for upload storage
Когда я обновляю запись, я могу выбрать файл, используя файл ввода, но столбцы для связанных компонентов пусты:
--- !ruby/object:Drawing
raw_attributes:
id: 1
url: blah blah
title: My new thing
description: Dog's Breakfast
created_at: '2015-10-15 20:02:03.848104'
updated_at: '2015-10-15 20:02:33.344581'
image_file_name:
image_content_type:
image_file_size:
image_updated_at:
...