module Hancock::Faq::Models::Question
Public Class Methods
manager_can_add_actions()
click to toggle source
# File lib/hancock/faq/models/question.rb, line 53 def self.manager_can_add_actions ret = [:nested_set] ret << :model_settings if Hancock::Faq.config.model_settings_support # ret << :model_accesses if Hancock::Faq.config.user_abilities_support ret << :hancock_touch if Hancock::Faq.config.cache_support ret += [:comments, :model_comments] if Hancock::Faq.config.ra_comments_support ret.freeze end
rails_admin_add_visible_actions()
click to toggle source
# File lib/hancock/faq/models/question.rb, line 61 def self.rails_admin_add_visible_actions ret = [:nested_set] ret << :model_settings if Hancock::Faq.config.model_settings_support ret << :model_accesses if Hancock::Faq.config.user_abilities_support ret << :hancock_touch if Hancock::Faq.config.cache_support ret += [:comments, :model_comments] if Hancock::Faq.config.ra_comments_support ret.freeze end
Public Instance Methods
category_class()
click to toggle source
# File lib/hancock/faq/models/question.rb, line 79 def category_class Hancock::Faq::Category end
full_name()
click to toggle source
# File lib/hancock/faq/models/question.rb, line 75 def full_name "#{self.author_name_output}: \"#{self.question_text_output}\"".freeze end
name()
click to toggle source
# File lib/hancock/faq/models/question.rb, line 71 def name "#{self.question_text_output} (#{self.author_name_output})".freeze end
set_default_main_category(force = false)
click to toggle source
# File lib/hancock/faq/models/question.rb, line 28 def set_default_main_category(force = false) if force or main_category.blank? or !main_category.enabled and self.respond_to?(:categories) self.main_category = self.categories.enabled.sorted.first end self.categories << self.main_category if self.main_category self end