Connoisseurs! I ask the help to understand a syntactic problem. I have such a construction in DOM:

<%= image_tag('play.svg', alt: "Rails logo", class: "play#{index+1}") %> 

and I have a variable:

 <%= album_info.album %> 

Task. Assign constructions id whose value would be the given variable.

My thoughts:

 <%= image_tag('play.svg', alt: "Rails logo", class: "play#{index+1}", id: <%= album_info.album %>) %> 

gives a spelling error.

 <%= image_tag('play.svg', alt: "Rails logo", class: "play#{index+1}", id: "<%= album_info.album %>") %> 

gives a spelling error.

How is it all right?

  • I meant a syntax error. - Dmitry Borgir 5:58 pm

1 answer 1

The id: ... slice is already inside the tag:

 <%= image_tag('play.svg', alt: "Rails logo", class: "play#{index+1}", id: album_info.album) %> 
  • one
    I am very grateful, in a few minutes I will click the tick of the solved problem. - Dmitry Borgir 5:56 pm