Questions tagged [refile]

Refile is a modern file upload library for Ruby applications.

Features:

  • Configurable backends, file system, S3, etc...
  • Convenient integration with ORMs
  • On the fly manipulation of images and other files
  • Streaming IO for fast and memory friendly uploads
  • Works across form redisplays, i.e. when validations fail, even on S3
  • Effortless direct uploads, even to S3

Homepage

64 questions
13
votes
2 answers

Refile gem : multiple file uploads

I'm using Refile with Rails 4. I'm following their tutorial for multiple image upload. Each Post can have multiple Images. My models look like this: Post.rb: has_many :images, dependent: :destroy accepts_attachments_for :images, attachment:…
the_
  • 1,183
  • 2
  • 30
  • 61
8
votes
2 answers

org-mode - no refile targets

I am trying to use the refile function but don't understand why I get the error no refile targets after hitting the Cc Cw key. Here is the content of org-refile-targets variable : Its value is (("~/gtd/gtd.org" :maxlevel . 3) ("~/gtd/someday.org"…
tuculuxu
  • 91
  • 2
  • 4
7
votes
3 answers

Get image dimensions using Refile

Using the Refile gem to handle file uploading in Rails, what is the best way to determine image height and width during / after it has been uploaded? There is no built in support for this AFAIK, and I can't figure out how to do it using MiniMagick.
Chris Edwards
  • 3,514
  • 2
  • 33
  • 40
4
votes
1 answer

How can I duplicate a Refile attachment between Rails models?

I am using refile and have two models: class UserApplication < ActiveRecord::Base attachment :avatar end class User < ActiveRecord::Base attachment :avatar def from_application(application) # ... self.avatar = application.avatar …
Michał
  • 374
  • 1
  • 3
  • 16
4
votes
1 answer

refile simple_form undefined method attachment_field

I am trying to hook up refile to my view and I am getting the following error: Here are my models: class Job < ActiveRecord::Base acts_as_paranoid acts_as_taggable acts_as_taggable_on :languages belongs_to :company belongs_to…
Chris Hough
  • 3,389
  • 3
  • 41
  • 80
4
votes
0 answers

How to preserve file names when uploading a file using the refile gem in rails app

I'm trying to preserve the file name of a file that I am uploading to rails app using the refile gem. I created an API within the rails app to allow files to be uploaded via curl, but when I have a file, i.e. myfile.csv and I upload it to the rails…
ipatch
  • 3,933
  • 8
  • 60
  • 99
4
votes
1 answer

Pundit authorizaton for files uploaded with Refile gem

How would I do authorization on files uploaded with Refile gem using Pundit? I have uploaded files which should be restricted to the user that uploaded them, but anyone with the url that Refile's attachment_url generates can access the file. Since…
Jerome
  • 43
  • 3
3
votes
0 answers

Rails - Refile - IO error closed stream

I have three models Product, Image, Post. Post and Product have many Images, which is polymorphic. When I try to create either a new Product or Post with included images I get: IOError (closed stream): app/controllers/posts_controller.rb:18:in…
greyoxide
  • 1,197
  • 1
  • 17
  • 45
3
votes
1 answer

Rails - Refile Gem - undefined method `file_id_will_change!'

I have a Property model which has many photos. Im trying to use the refile gem to upload images. class Property < ActiveRecord::Base has_many :photos, :dependent => :destroy accepts_attachments_for :photos, attachment: :file end class Photo <…
greyoxide
  • 1,197
  • 1
  • 17
  • 45
3
votes
0 answers

how to migrate from paperclip to refile and to export/import the files?

I am trying to do something like a script to copy my files from the paperclip structure to refile structure. My files are stored on Amazon s3. There is a way to make this? My choose for the change is because i want to upload my files directly for…
3
votes
1 answer

Text file busy @ unlink_internal

I'm having an issue with refile and vagrant using synced folders. The issue is that whenever i try to save a file the following error occurs: Errno::ETXTBSY (Text file busy @ unlink_internal -…
Rogue
  • 83
  • 9
3
votes
1 answer

Refile accepts_attachments_for issue

I'm using Refile with a rails 4 app. I'm getting the error: undefined methodaccepts_attachments_for'` I'm trying to do multiple image upload, and have two models: books and blobs. My books.rb: has_many :blobs, dependent:…
the_
  • 1,183
  • 2
  • 30
  • 61
2
votes
1 answer

Saving multiple files with refile not working

Im using refile to upload some photos for an album in my project. My models are like this: class Album < ApplicationRecord has_many :photos,dependent: :destroy class Photo < ApplicationRecord belongs_to :user belongs_to :album attachment…
Fernando Maymone
  • 355
  • 2
  • 15
2
votes
0 answers

Save image details on upload to amazon S3 with refile gem, Ruby on Rails

Hi I am trying to upload images directly to S3 using refile gem project.rb looks like class Project < ActiveRecord::Base has_many :photos, :class_name => "Project::Photo", dependent: :destroy accepts_attachments_for…
red-devil
  • 1,064
  • 1
  • 20
  • 34
2
votes
1 answer

Refile, how to show filename for multiple uploads

I'm trying to implement multiple file uploads with the Refile gem. The user has to be able to upload multiple documents to a tournament model. In the show template, I try to read out all uploaded documents like this: <% @tournament.documents.each do…
Toontje
  • 1,415
  • 4
  • 25
  • 43
1
2 3 4 5