Class: Topic

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/topic.rb

Instance Method Summary collapse

Instance Method Details

#bodyObject



55
56
57
# File 'app/models/topic.rb', line 55

def body
  posts.first.body
end

#dom_idObject



37
38
39
# File 'app/models/topic.rb', line 37

def dom_id
  "topic_#{self.id}"
end

#readerObject



51
52
53
# File 'app/models/topic.rb', line 51

def reader
  posts.first.reader
end

#titleObject



59
60
61
# File 'app/models/topic.rb', line 59

def title
  name
end

#visible_to?(reader = nil) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
44
45
46
47
48
49
# File 'app/models/topic.rb', line 41

def visible_to?(reader=nil)
  if forum && !forum.visible_to?(reader)
    false
  elsif !reader && !Radiant::Config['forum.public?']
    false
  else
    true
  end
end