Search code examples
ruby-on-railsrubyimagerefile

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: :destroy
accepts_attachments_for :blobs

My blobs.rb:

belongs_to :book
attachment :file

If I check rake routes, it shows that refile is mounted, so what is the issue?


Solution

  • The feature you're looking to use is discussed here: https://github.com/refile/refile/issues/6 and it doesn't seem to be released yet. If you want to use it, you'll need to use the master branch. You can try using the master branch by changing your Gemfile:

    gem 'refile', require: "refile/rails", git: 'https://github.com/refile/refile.git', branch: 'master'