Class: PublicContent

Inherits:
ApplicationRecord show all
Includes:
Housekeeping
Defined in:
app/models/public_content.rb

Overview

A snapshot of the working content that is OK for public consumption.

  • This needs work to resolve b/w OTU and other content.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Attribute Details

#content_idInteger

Returns pointer to the working version.

Returns:

  • (Integer)

    pointer to the working version



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/models/public_content.rb', line 25

class PublicContent < ApplicationRecord
  include Housekeeping

  belongs_to :otu, inverse_of: :public_contents
  belongs_to :topic
  belongs_to :content, inverse_of: :public_content

  validates_presence_of :text, :topic_id # is general, or always OTU?

  ignore_whitespace_on(:text)

  def is_current?
    content.text == text 
  end

  def self.is_community?
    false
  end

end

#otu_idInteger

Returns they Otu.

Returns:

  • (Integer)

    they Otu



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/models/public_content.rb', line 25

class PublicContent < ApplicationRecord
  include Housekeeping

  belongs_to :otu, inverse_of: :public_contents
  belongs_to :topic
  belongs_to :content, inverse_of: :public_content

  validates_presence_of :text, :topic_id # is general, or always OTU?

  ignore_whitespace_on(:text)

  def is_current?
    content.text == text 
  end

  def self.is_community?
    false
  end

end

#project_idInteger

the project ID

Returns:

  • (Integer)


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/models/public_content.rb', line 25

class PublicContent < ApplicationRecord
  include Housekeeping

  belongs_to :otu, inverse_of: :public_contents
  belongs_to :topic
  belongs_to :content, inverse_of: :public_content

  validates_presence_of :text, :topic_id # is general, or always OTU?

  ignore_whitespace_on(:text)

  def is_current?
    content.text == text 
  end

  def self.is_community?
    false
  end

end

#textString

Returns the meat.

Returns:

  • (String)

    the meat



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/models/public_content.rb', line 25

class PublicContent < ApplicationRecord
  include Housekeeping

  belongs_to :otu, inverse_of: :public_contents
  belongs_to :topic
  belongs_to :content, inverse_of: :public_content

  validates_presence_of :text, :topic_id # is general, or always OTU?

  ignore_whitespace_on(:text)

  def is_current?
    content.text == text 
  end

  def self.is_community?
    false
  end

end

#topic_idInteger

Returns the topic.

Returns:

  • (Integer)

    the topic



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/models/public_content.rb', line 25

class PublicContent < ApplicationRecord
  include Housekeeping

  belongs_to :otu, inverse_of: :public_contents
  belongs_to :topic
  belongs_to :content, inverse_of: :public_content

  validates_presence_of :text, :topic_id # is general, or always OTU?

  ignore_whitespace_on(:text)

  def is_current?
    content.text == text 
  end

  def self.is_community?
    false
  end

end

Class Method Details

.is_community?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/models/public_content.rb', line 40

def self.is_community?
  false
end

Instance Method Details

#is_current?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'app/models/public_content.rb', line 36

def is_current?
  content.text == text 
end