I want to achieve

I want to pass the variables written in index.html.slim to _share.html.slim using render partial and locals.
(I want to use variables in the divided files.)

Current status

In the following situations, you will get angry if there is no score variable, such as undefined local variable or method `score'. It seems that the score variable has not arrived in _share.html.slim in the first place.

[email protected] products.zip (@scores) do | product, score |
(~ Various tags ~)
= Render partial:'share', locals: {product: product, score: score}
-Puts "# {score}"
-Puts "# {product}"
What I tried

(1) The same thing was described in index.html.slim without dividing the file.
→ Success (displayed without error)

(2) The only variable passed by locals is score.
→ Failure (same error)

(3) The only variable passed in locals is product.
→ Success (displayed without error)

  • Answer # 1

    When I see what I triedscoreIt's just a strange thing.
    First, make sure that double-byte spaces and zero-width spaces are not mixed on both the called/called side.
    If that doesn't work,scoreTry using a variable name other than.