with_scope###ロコモティブ CMS での使用について質問があります。
まずmovies、完全なフィールドを持つモデル があり、そのうちの 1 つがfilm_etatswithで呼び出されtype: belongs_toます。
別のモデルfilm_etatsがあり、のetatフィールドtype: stringと の別のフィールドmoviesがありtype: has_manyます。
これで問題なく動作します - 自分のデータを見ることができます - しかし、やりたいことは情報をフィルタリングすることです。
Locomotive CMS のドキュメントには、 https ://doc.locomotivecms.com/docs/tags#with_scope があります。
これが最初の例です。
{% with_scope author: 'John Doe' %}
{% for post in content_type.posts %}
{{ post.title }}
{% endfor %}
{% endwith_scope %}
だから私はこれをしました:
{% with_scope film_etats.etat: 'Production' %}
{% for film in contents.film %}
etat du film : {{film.film_etats.etat}}
{% endfor %}
{% endwith_scope %}
しかし、それは機能せず、私が望むものは型エラーです:nilの未定義メソッド「エントリ」:NilClass
私のモデル映画
title_film => type (string)
film_etats => type belongs_to
私のモデル film_etats
etat => type(string)
films => type(has_many)
ありがとう