Module: RailsAdminTagList::SuggestionsHelper
- Defined in:
- app/helpers/rails_admin_tag_list/suggestions_helper.rb
Instance Method Summary collapse
Instance Method Details
#tag_suggestions(field, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/rails_admin_tag_list/suggestions_helper.rb', line 3 def tag_suggestions(field, = {}) defaults = { :order => { :count => :desc }, :length => 5 } = defaults.deep_merge() model = field.abstract_model.model_name.constantize = field.name.to_s.gsub(/_list/, '').pluralize.to_sym = model.tag_counts_on() = (, [:order]) [0..[:length]].map(&:name) end |