You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
@dtengeri you save my morning.
Guys please update Getting started guide!
Now I have messed up translation table with duplicates (and I wonder why globalize did not add unique index on [id, locale])
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
The text was updated successfully, but these errors were encountered: