0

I am using image_tag in rails views and here is my code:

<%= image_tag "01-landing_page.png" class: "img-responsive" %>

But when I am running it. I am getting :

app/views/home/index.html.erb:252: syntax error, unexpected ':', expecting ')'
app/views/home/index.html.erb:288: syntax error, unexpected keyword_class, expecting ')'

What I am doing wrong here. I followed a lot of SO post but all of them are mentioning to write the class in a same manner.

1 Answer 1

1

You have a little syntax error in your code. There should be a comma after the image as follow:

<%= image_tag "01-landing_page.png", class: "img-responsive" %>

I'm sure that putting that comma there will solve the problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.