Получавам следната грешка, когато използвам отношение belongs_to
NoMethodError в Admin::PropertyDetailsController#index недефиниран метод `property_types' за #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