Skip to content

Updating record creates new translation records instead of updating them #33

Open
@martin-macak

Description

@martin-macak

I have simple application like this

have a model class model.rb

class Post < ActiveRecord::Base
active_admin_translates :title, :text do
validates_presence_of :title
end
end
And appropriate migration

class CreatePosts < ActiveRecord::Migration
def up
create_table :posts do |t|
t.timestamps
end
Post.create_translation_table! title: :string, text: :text
end

def down
drop_table :posts
Post.drop_translation_table!
end
end
Active admin page is configured like this

ActiveAdmin.register Post do
permit_params :title, :text, translations_attributes: [:title, :text, :locale]

index do
translation_status
default_actions
end

form do |f|
f.translated_inputs 'Translated fields', switch_locale: false do |t|
t.input :title
t.input :text
end
f.actions
end
end

When I try to update record, new translation records are created instead updating the old ones causing the AA to display the first value.

I also posted this as a question on Stack Overflow at http://stackoverflow.com/questions/23547401/activeadmin-globalize-does-not-update-records

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