LoginSignup
6
1

More than 3 years have passed since last update.

Rails ActiveStorageのvariantでrails_blob_path - NoMethodError: undefined method `signed_id'

Posted at

問題

例えば条件に応じてグレースケールに加工した画像のpathだけを取りたい場合、通常のようにrails_blob_pathを使うとエラーになる

# NoMethodError: undefined method `signed_id' が出る
Rails.application.routes.url_helpers.
  rails_blob_path image.variant(type: :grayscale).processed, only_path: true


解決方法

variantを使った場合、rails_representation_pathを使う必要がある。

Rails.application.routes.url_helpers.
  rails_representation_path image.variant(type: :grayscale).processed, only_path: true
6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1