softace/paperclip_database

undefined method `downloads_files_for' for GroupsController:Class

Opened this issue · 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!

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.

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.

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'

This is still open :(