I noticed the docs have:
<%= item_counter %>
But I have a partial which I want to add a class into on every 6th one, is there an easy way to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can pass variables into the partial’s instance scope when you call it, and inside the partial you can then take action based on the value of those instance variables.
So if you have the local variable item_counter in the view containing the partial, render the partial like this:
Inside the partial, you will now be able to access the local variable item_counter. Thus inside the partial you could have: