I have a star ratings feature. And pretty much, I would like it to display a particular image depending on the number.
Here’s some pseduo code I would like to do in my review.rb model
def show_stars
if rating = 1
display 1star.png
elsif rating = 2
display 2star.png
elsif rating = 3
display 3star.png
elsif rating = 4
display 4star.png
elsif rating = 5
display 5star.png
end
How would I make this code work? And also, how would I make it display right in a view file?
This should really go into a view helper.
Then in your view: