I’m develop a website using ruby on rails. I searched google found a CSS way to make my picture round border. It’s indeed working, but it’s reading the database twice, do you guys have anyway to read only once? For example, to store the image into the temporary local variable like @img ? Here’s the code:
<p style="background-image: url(<%= micropost.photo.url(:large) %>)">
<%= image_tag micropost.photo.url(:large) rescue "<p>No image</p>"%>
</p>
Thanks!
Your answer is in the question! Just store the url in a variable.