app/controllers/admin/base_controller.rb in fullstack-admin-0.1.35 vs app/controllers/admin/base_controller.rb in fullstack-admin-0.1.36
- old
+ new
@@ -24,11 +24,12 @@
:plural_name,
:resource_name,
:collection_name,
:current_resource_class,
:current_resource,
- :current_collection
+ :current_collection,
+ :title_column
def current_resource_class
@current_resource_class ||= controller_name.singularize.camelize.constantize
end
@@ -50,7 +51,13 @@
end
def current_collection
instance_variable_get("@#{collection_name}")
end
+
+ def title_column(model)
+ @_title_columns ||= {}
+ @_title_columns[model] ||= ( model.column_names.map{ |c| c.to_s } & %W(title name label browser_title seo_title seo_name key claim email) ).first
+ end
+
end