1

使用 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
4

1 回答 1

0

我已经在github上发布了同样的问题,并且已经解决。您可以在以下位置查看解决方案

https://github.com/gregbell/active_admin/issues/2597

于 2013-10-22T04:11:17.843 回答