Class: Thredded::PrivateTopic

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Includes:
TopicCommon
Defined in:
app/models/thredded/private_topic.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TopicCommon

#last_user, #private?, #user

Class Method Details

.friendly_find!(slug_or_id) ⇒ Thredded::PrivateTopic

Finds the topic by its slug or ID, or raises Thredded::Errors::PrivateTopicNotFound.

Parameters:

  • slug_or_id (String)

Returns:

Raises:



58
59
60
61
62
# File 'app/models/thredded/private_topic.rb', line 58

def self.friendly_find!(slug_or_id)
  friendly.find(slug_or_id)
rescue ActiveRecord::RecordNotFound
  raise Thredded::Errors::PrivateTopicNotFound
end

Instance Method Details

#normalize_friendly_id(input) ⇒ Object



72
73
74
# File 'app/models/thredded/private_topic.rb', line 72

def normalize_friendly_id(input)
  Thredded.slugifier.call(input.to_s)
end

#public?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'app/models/thredded/private_topic.rb', line 64

def public?
  false
end

#should_generate_new_friendly_id?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'app/models/thredded/private_topic.rb', line 68

def should_generate_new_friendly_id?
  title_changed?
end