Fix poll question with non-underscored locales

Ruby can't have hyphens in method names, so sending something like
`title_pt-BR=` would raise an exception.
This commit is contained in:
Javi Martín
2018-10-23 14:23:10 +02:00
parent b8673c1cbf
commit ccdbdb26ba
2 changed files with 25 additions and 8 deletions

View File

@@ -45,7 +45,7 @@ class Poll::Question < ActiveRecord::Base
self.author = proposal.author
self.author_visible_name = proposal.author.name
self.proposal_id = proposal.id
send(:"title_#{Globalize.locale}=", proposal.title)
send(:"#{localized_attr_name_for(:title, Globalize.locale)}=", proposal.title)
end
end