NoMethodError: private method `open' called for # (Most recent call first) File /app/app/interactors/order/store_purchases.rb line 55 in store_purchase
...
purchase.capture.attach(io: URI.parse(context.capture).open, filename: context.capture)
...
This error on only on heroku deploy... What I did wrong? Help me please
It seems that you did not include open-uri
.
https://ruby-doc.org/stdlib-2.5.3/libdoc/open-uri/rdoc/OpenURI.html
Try this
require 'open-uri'
URI.parse(context.capture).open
URI#open
is private on older Ruby versions, for example 2.2. You need to use a different method (such as the global open
provided by open-uri
, though this is questionable from the security standpoint) on those Rubies. Or use a newer Ruby version.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.