Skip to content

Single language field with accepts_nested_attributes_for not stored #31

Open
@phlegx

Description

@phlegx

Hi!

I use the latest version of the gem. I have a view with three text fields, one for every language. If I want to submit the form where one text field (e.g. language field English) is filled out and the other two are empty, then the changes are not stored in database. I have checked the params and all three fields are present in the params. English field has a content the other two are empty.

Project has many tasks as nested fields. The model Project accepts nested attributes for tasks.

# controller
def update
    @project = Project.find(params[:id])
    @project.assign_attributes(params)
    ...
    @project.save
end

My Task model:

  ...
  translates :description
  globalize_accessors
  ...

If I delete the rows in table task_translations related to the tasks and re-submit the form, all works fine. Any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions