paperclip_database icon indicating copy to clipboard operation
paperclip_database copied to clipboard

undefined method `downloads_files_for' for GroupsController:Class

Open marcgc opened this issue 11 years ago • 4 comments

After adding the downloads_files_for in my controller I get the next error:

undefined method `downloads_files_for' for GroupsController:Class

Any ideas?

Thanks!

marcgc avatar Dec 13 '13 17:12 marcgc

I'm having this same issue.

To work around I just created my own method for downloading the file. This should mimic the same method that is generated by downloads_files_for:

# GET /users/avatars/1?style=original
def avatars
  @user = User.find(params[:id])
  style = params[:style] ? params[:style] : 'original'
  send_data @user.send(:avatar).file_contents(style),
    :filename => @user.avatar_file_name,
    :type => @user.avatar_content_type
end

But it would be good to see this fixed, as it's quite confusing.

asgeo1 avatar Feb 11 '14 00:02 asgeo1

Thanks for reporting this.

I have looked into it. It's a (documented) feature that I have never been aware of (since I took over maintenance). I'll see if I can reintroduced this feature in a RESTfulness way.

jarl-dk avatar Mar 17 '14 07:03 jarl-dk

We were just able to use this by including Paperclip::Storage::Database::ControllerClassMethods in the controller that we were trying to use downloads_files_for. It also required us to add the route for the file to routes.rb, ex: get ':class_name/:attachment_name/:id', to: ':class_name#:attachment_name'

willsteinmetz avatar Mar 25 '15 20:03 willsteinmetz

This is still open :(

busbyjon avatar Apr 17 '16 18:04 busbyjon