customizing subcategory name in dropdowns, yay:)

This commit is contained in:
Edin Dazdarevic
2015-02-12 21:37:23 +01:00
parent f2d16d0968
commit 9c461cc7c5

View File

@@ -2,4 +2,15 @@ class SubCategory < ActiveRecord::Base
belongs_to :category
has_many :items
has_many :filter_criterias, as: :owner
rails_admin do
object_label_method do
:custom_subcat_name
end
end
def custom_subcat_name
cat = self.category.name
section = self.category.section.name
"#{section} -> #{cat} -> #{self.name}"
end
end