You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using this gem for a long time, since Spree 1.1. But only now I've encountered a problem with the approach used by the gem using method_missing for establishing the relation between the item (in my case, Spree::Product) and its related items.
The name field is being used in the front-end for dynamic exhibition for relation types, as the following code demonstrates:
<% @relation_types.each do |relation_type| %> <% products = @product.send(relation_type.name.parameterize('_')) %> <% next if products.empty? %> <%= content_tag :h3, relation_type.name %>
[iteration over each product...]
<% end %>
The problem is that the name have accents, because the current locale is pt-BR.
I thought that this could be solved in two different ways and I would like the opinion of the community:
One of them would be adding an extra field to identify internally the relation, or keeping the name and adding a field like presentation to appear in the front end.
The other way would be changing the format_name method using parameterize instead of downcase, to avoid problems with accents.
Hello!
I've been using this gem for a long time, since Spree 1.1. But only now I've encountered a problem with the approach used by the gem using method_missing for establishing the relation between the item (in my case, Spree::Product) and its related items.
The name field is being used in the front-end for dynamic exhibition for relation types, as the following code demonstrates:
The problem is that the name have accents, because the current locale is pt-BR.
I thought that this could be solved in two different ways and I would like the opinion of the community:
One of them would be adding an extra field to identify internally the relation, or keeping the name and adding a field like presentation to appear in the front end.
The other way would be changing the format_name method using parameterize instead of downcase, to avoid problems with accents.
Old code
New code
I'm not having errors, at least not in development environment, but I guess a method name with accents isn't a good thing...
What you guys think about it?
If you have other solution, I would be glad to read it!
Thanks!
The text was updated successfully, but these errors were encountered: