Ruby on Rails with Globalize3: find by translated field makes record readonly

戏子无情 提交于 2020-01-03 03:07:32

问题


I´m using rails 3.0.7 with the globalize3 gem.

I have the model "Country" with traslated field "title".

In the rails console, try to find the record by its translated title like this:

gr = Country.find_by_title 'Greece'

This returns the correct record. But it is set to readonly, so I cannot save it.

Is this expected behaviour? What is causing it? I suspect it has something to to with some join generated by globalize3, but this is just an educated guess.

Is there a way around it, except just use the id to find the record?

来源:https://stackoverflow.com/questions/9496816/ruby-on-rails-with-globalize3-find-by-translated-field-makes-record-readonly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!