0

Probably something really simple but keep getting syntax errors.. I want to add a class to my image_tag, which is using a helper to form part of a url , though didnt think this would effect where i put my class.

<%= image_tag(aws_asset "/assets/img/thumb-1.jpg"), :class => "stock" %>

Can anyone see anything obvious that im missing.

Thanks

1 Answer 1

1

Try this:

<%= image_tag(aws_asset("/assets/img/thumb-1.jpg"), :class => "stock") %>

Edit: Your original code was calling the image_tag function with the result of aws_asset "/assets/img/thumb-1.jpg as the only parameter (the :class => "stock" bit was left out). The additional parentheses change call to the image_tag function to have two parameters, the first being the result of aws_asset("/assets/img/thumb-1.jpg") and the second being :class => "stock".

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

1 Comment

brilliant, will accept as soon as it lets me, could you explain the extra brackets please

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.