使用 belongs_to 关系时出现以下错误
NoMethodError in Admin::PropertyDetailsController#index undefined method `property_types' for #AdminUser:0x00000005e59a70
请帮助解决问题。
我正在使用 ActiveAdmin 0.60 与 ruby 2.0.0p247 和 Rails 4。
Gemfile:gem 'activeadmin',github:'gregbell/active_admin',分支:'rails4'
ActiveAdmin.register PropertyDetail do
belongs_to :property_type
menu :label => "Latest Properties in the Town"
controller do
def permitted_params
params.permit(:property_detail => [:title ,:description, :image_url, :price, :land_area, :land_unit, :contact_id, :property_type_id, :purpose_id])
end
end
index do
column :title
column :description
column :image_url
column :price, :sortable => :price do |property_detail|
div :class => "price" do
number_to_currency property_detail.price
end
end
end
form :partial => "form"
end
ActiveAdmin.register PropertyType do
end