Skip to content

Conversation

mpestov
Copy link

@mpestov mpestov commented Jan 20, 2019

Hey! I have found a bug related single table inheritance models in selected_list input. If you registered one model in ActiveAdmin and try to edit another model within ActiveAdmin form then nothing update in your app.
For example:
I have 3 models Animal, Cat (parent is Animal), Group. Also I have form like this

ActiveAdmin.register(Animal) 
  forms do |f|
    f.input group_ids, as: selected_list
  end
end

After i try to edit Cat model via this form but nothing updated. Because form renders input with name: cat[group_ids][] although ActiveAdmin expect input with name: animal[group_ids][].

I think my PR will fix this bug.

t.integer "animal_id", null: false
end

add_index "animals_groups", ["group_id", "animal_id"], name: "index_animals_groups_on_group_id_and_animal_id"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [111/100]

class CreateJoinTableGroupAnimal < ActiveRecord::Migration
def change
create_join_table :groups, :animals do |t|
t.index [:group_id, :animal_id]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 (not 3) spaces for indentation.

class CreateGroups < ActiveRecord::Migration
def change
create_table :groups do |t|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at block body beginning.

@mpestov mpestov force-pushed the fix-sti-model-name branch from d5116b3 to 8b6a324 Compare January 20, 2019 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants