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
I've have a State table where the primary key is not :id, it is :abbr. It also has a :name column.
# db/migrate/create_states.rb
class CreateStates < ActiveRecord::Migration[6.1]
def change
create_table :states, id: false, bulk: true do |t|
t.primary_key :abbr, :string, limit: 2
t.string :name, null: false
t.timestamps
end
end
end
# app/model/state.rb
class State < ApplicationRecord
end
# app/admin/states.rb
ActiveAdmin.register State do
config.sort_order = 'abbr_asc'
end
I've made a selected list for them.
f.input :state_ids,
label: "States",
as: :selected_list,
order_by: "abbr_asc",
fields: [:abbr, :name],
wrapper_html: { title: "Restrict to these US states only." }
The searching works fine, but I cannot click on the shown states. There are no Javascript errors in console.
If I add a fake id column it works.
# app/model/state.rb
class State < ApplicationRecord
attribute :id, type: :string
end
The text was updated successfully, but these errors were encountered:
I've have a State table where the primary key is not :id, it is :abbr. It also has a :name column.
I've made a selected list for them.
The searching works fine, but I cannot click on the shown states. There are no Javascript errors in console.
If I add a fake
id
column it works.The text was updated successfully, but these errors were encountered: