Hi I use slim in rails instead of erb. I need to generate dynamic ids based on the id of the record passed to the view page. This is a part of my code:
#clear_class_"#{activity.id}"
- user = activity.user
.row
.col-xs-3.col-md-2.person_img
= link_to (image_tag user.avatar.url :normal, alt: user.full_name, class: 'img img-responsive'), user_path(user)
...
when I try using #clear_class_"#{activity.id}" the view is getting distorted. How can I make this division a dynamic one with my activity id appended to the division id.
Another option, if you just want to use basic string interpolation, would be this:
div id="clear-class-#{activity.id}"
Try this instead:
div id=dom_id(activity, 'clear_class')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With