locomotivecms / engine

A platform to create, publish and edit sites
http://www.locomotivecms.com
Other
2.32k stars 625 forks source link

Localized fields don't render correctly in forms #1414

Closed did closed 3 months ago

did commented 3 months ago

Explanation:

The Rails ActionView inputs get the value of a field from the _before_type_cast method if it exists. In Mongoid 7, the Mongoid core team implemented the _before_type_cast? / _before_type_cast for ALL the fields including the localized ones.

Incidentally, it breaks the form inputs for localized fields.

This patch restores the old behavior for localized fiels by implementing the X_came_from_user? method which makes the form inputs use the translated value of a field.