我正在使用复合主键 gem 和 active_admin,但我遇到了索引页面的问题。我可以以某种方式自定义 index.html.arb 文件吗?或者更改belongs_to 关联?
我的模型:
class Vehicle < ActiveRecord::Base
self.table_name = "vehicle"
self.primary_key = "vehicle_id"
belongs_to :operator, :foreign_key => :operator_id
**belongs_to :orgunit, :foreign_key => [:operator_id, :run_code]**
应用程序/管理员/车辆.rb
ActiveAdmin.register Vehicle do
index do
id_column
column :version
column :description
default_actions
结尾
索引页错误:
NoMethodError in Admin/vehicles#index
Showing /home/dev/.rvm/gems/ruby-1.9.3-p125@global/gems/activeadmin-
0.5.0/app/views/active_admin/resource/index.html.arb where line #1 raised:
undefined method `to_sym' for [:operator_id, :run_code]:Array
Extracted source (around line #1):
1: insert_tag renderer_for(:index)