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:



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

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



86
87
88
# File 'app/models/thredded/private_topic.rb', line 86

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

#public?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'app/models/thredded/private_topic.rb', line 78

def public?
  false
end

#should_generate_new_friendly_id?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'app/models/thredded/private_topic.rb', line 82

def should_generate_new_friendly_id?
  title_changed?
end