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

NoMethodError: private method `select' called for nil:NilClass #2675

Closed
celsoMartins opened this issue Jul 17, 2023 · 4 comments
Closed

NoMethodError: private method `select' called for nil:NilClass #2675

celsoMartins opened this issue Jul 17, 2023 · 4 comments

Comments

@celsoMartins
Copy link

Hey folks.

carrierwave 3.0.0

I'm getting this error while trying to test invalid forms with image upload. It started to happen after the last gem update.

NoMethodError: private method `select' called for nil:NilClass

  0) ArticlesController authenticated as editor PUT #update with invalid data does not update the article and renders the form with errors
     Failure/Error: if @article.update(update_params.except(:featured_image).freeze)

     NoMethodError:
       private method `select' called for nil:NilClass
     # /Users/celsomartins/.rvm/gems/ruby-3.2.2@aposta10/gems/carrierwave-3.0.0/lib/carrierwave/mounter.rb:205:in `remove_added'
     # /Users/celsomartins/.rvm/gems/ruby-3.2.2@aposta10/gems/carrierwave-3.0.0/lib/carrierwave/mount.rb:400:in `remove_rolled_back_og_image'

The exception occurs in the current_paths = (@removed_uploaders + @uploaders.select(&:staged)).map(&:path)

    def remove_added
      current_paths = (@removed_uploaders + @uploaders.select(&:staged)).map(&:path)
      @added_uploaders
        .reject {|uploader| current_paths.include?(uploader.path) }
        .each { |uploader| uploader.remove! }
      reset_changes!
    end

I'll fix the gem version to the one that was working.

Thanks.

@BrianHawley
Copy link
Contributor

This should be fixed by #2674. Try the master branch and see if that solves your issue. If it does, you this will be fixed in the next version. If you're still getting the NoMethodError with the master branch, post your results here.

@celsoMartins
Copy link
Author

Thank you, Brian.

I'm not hurrying to update the version, so I'll wait for the official release.

Thanks for the issue confirmation and for the quick response.

@joshwestbrook
Copy link

@BrianHawley Is there any estimate for when the release containing this fix will be available? Using master fixed the issue, but we try (our hardest) not to include dependencies that point to git branches so that our vulnerability scans can pick up new CVEs

@mshibuya
Copy link
Member

Closing as 3.0.1 was released.

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

4 participants