1
votes

I'm working with heroku in app made in Rails 5.1.1 wich uses Cloudinary like image server and atacchinary to upload it.

This is the first time I use attachinary with rails 5, and when I upload the image with the input <%= f.attachinary_file_field :image_event %>, it works fine. The image is uploaded and I can see it on cloudinary dashboard.

The question is: wuen I going to create the information, it returns to edit the infos in the crud with a error in the file input.

Saying: Image files is invalid

I think its something with association, because the image is uploaded, but I dont have sure. The error occurs in development and in production.

The field is already in required parameters on controller

development:
  cloud_name: xxxxxxxxxxxxx
  api_key: 'xxxxxxxxxxxxx'
  api_secret: xxxxxxxxxxxxx
  enhance_image_tag: false // changed to false to work with rails 5
  static_image_support: false
production:
  cloud_name: xxxxxxxxxxxxx
  api_key: 'xxxxxxxxxxxxx'
  api_secret: xxxxxxxxxxxxx
  enhance_image_tag: false
  static_image_support: false
test:
  cloud_name: xxxxxxxxxxxxx
  api_key: 'xxxxxxxxxxxxx'
  api_secret: xxxxxxxxxxxxx
  enhance_image_tag: true
  static_image_support: true

My Model Event:

  has_attachment  :image_event, accept: [:jpg, :png, :gif]
1
Can you share your form and controller codes too? - Itay Taragano

1 Answers

1
votes

The error is suggesting that the ORM might not be properly set up when an image is included through Attachinary. Make sure to include the specific ORM you wish to use by adding following line to your application.rb file (or custom initializer):

e.g.

require "attachinary/orm/YOUR_ORM" # active_record or mongoid

More info on that can be found here: https://github.com/assembler/attachinary#installation