I can edit a join table in ActiveAdmin, only if the join table has one, and only one, primary key (id).
If I try to design a join table with only two fields (primary key on both), ActiveAdmin returns a NilClass error when I attempt to add a new record : undefined method 'humanize' for nil:NilClass
.
model :
class IngredientProduct < ActiveRecord::Base
belongs_to :product
belongs_to :ingredient
end
class Ingredient < ActiveRecord::Base
end
class Product < ActiveRecord::Base
end
ingredient_products fields :
product_id --> primary key, nn, integer
ingredient_id --> primary key, nn, integer
That doesn't work. My table "ingredient_products" must be designed this way :
id --> primary key, nn, integer
product_id --> integer
ingredient_id --> integer
to allow me to edit or add record with ActiveAdmin.
Do you know if ActiveAdmin support join tables that have only two fields, both used to define the primary key ?
My project : MySql, Rails 4.0.1 with ActiveRecord and ActiveAdmin 1.0.0.pre