ruby on rails - What is the best way using multiple lines of <% %> Tag or <% %> Tag with multiple lines? -


Sorry, if the title is not enough to understand what I'm asking about, I am a Rail developer and I In my thoughts, I used several lines of but now I realized that this is not the best practice, so I have come here and you are right in ROR, like all the best people?

For example, if I have to do something like the following

  & lt;% user = user.all% & gt; & Lt;% name = []% & gt; & Lt;% count = 0% & gt; For users & lt;% users% & gt; & Lt;% name & lt; & Lt; User.name% & gt; & Lt;% count + = 1% & gt; & Lt;% end% & gt;  

Can I do it like this?

  & lt;% user = user.all name = [] user = count for count = 0 & lt; & Lt; User.name count + = 1 end% & gt;  

I know that there is a better way to gather elements from the array, but the above example is just an example. But my question is, is this possible and if yes is the right way?

I think that is something different in the right way: exclude reasoning with ideas.

tells me what I mean.


Comments