1
我收到以下錯誤,當我使用belongs_to的關係主動聯繫:belongs_to的Rails中給「未定義的方法」錯誤4
NoMethodError在管理:: PropertyDetailsController#指數 未定義的方法`property_types'的#AdminUser:0x00000005e59a70
請幫忙解決問題。
我使用ActiveAdmin 0.60紅寶石2.0.0p247和Rails 4
的Gemfile: 寶石 '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