CMSタイプのアプリケーションを作成しようとしていますが、ユーザーが{{page.image_url | my_img_tag}}。
ヘルパーモジュールは次のとおりです。
module LiquidFilters
include ActionView::Helpers::TagHelper
include ActionView::Helpers::AssetTagHelper
def my_img_tag(image_name)
image_tag (image_name)
end
end
次に、レンダリング中に登録します。
def liquidize(content, arguments)
Liquid::Template.parse(content).render(arguments, :filters => [LiquidFilters]).html_safe
end
ただし、返される結果は次のとおりです。
Liquid error: undefined local variable or method `config' for #
ペーパークリップを使用してAWS-S3からの画像を検索しているため、自分でimgタグを作成したくありません。また、問題が発生するのではないかと心配しています。
どんな助けでも大歓迎です-私はruby&railsにかなり慣れていません。