Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error if product has no image #37

Open
alesisjoan opened this issue Feb 23, 2016 · 1 comment
Open

Error if product has no image #37

alesisjoan opened this issue Feb 23, 2016 · 1 comment

Comments

@alesisjoan
Copy link

I can't access the product's page if the product has no image. The problem is in _twitter.html.erb where it evals:

<meta property="twitter:image" content="<%= absolute_image_url(@product.images.first.attachment.url) %>" />

where @product.images.first is nil.

I fixed it in my project hardcoding a

<% unless @product.images.first.nil? %> <meta property="twitter:image" content="<%= absolute_image_url(@product.images.first.attachment.url) %>" /> <% end %>

@anthonyto
Copy link

I created a fork that resolves this.
https://github.com/anthonyto/spree_social_products

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants