Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-3549

How to get(display) and set localized fields?

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None

      Hello, I use last mongoid + rails 4.2.0,

      MODEL:
      class Article
      include Mongoid::Document

      field :title, localize: true
      field :content, localize: true

      end

      CONTROLLER:
      params.require(:article).permit(:title, :content)

      VIEW: form.html.haml
      = f.fields_for :title_translations, :title_translations do |fo|
      = fo.text_field :ru, value: fo.object["ru"]
      = fo.text_field :en, value: fo.object["en"]
      = fo.text_field :de, value: fo.object["de"]
      = fo.text_field :ja, value: fo.object["ja"]

      This code allows you to record all the localized field after clicking "Submit", but does not show when editing text fields in current values(blank fields).

      I beg your help to understand how to get and set localized fields without changing current locale from "form_for" and "form_tag".

      Thanx.

            Assignee:
            Unassigned Unassigned
            Reporter:
            Fudoshiki Fudoshiki [X]
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: