Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `downloads_files_for' for GroupsController:Class #11

Open
marcgc opened this issue Dec 13, 2013 · 4 comments
Open

undefined method `downloads_files_for' for GroupsController:Class #11

marcgc opened this issue Dec 13, 2013 · 4 comments

Comments

@marcgc
Copy link

marcgc commented Dec 13, 2013

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!

@asgeo1
Copy link

asgeo1 commented Feb 11, 2014

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.

@jarl-dk
Copy link
Member

jarl-dk commented Mar 17, 2014

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.

@willsteinmetz
Copy link

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'

@busbyjon
Copy link

This is still open :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants