Class SentenceReference
In: app/models/sentence_reference.rb
Parent: ActiveRecord::Base

Methods

Public Instance methods

[Source]

    # File app/models/sentence_reference.rb, line 12
12:   def reference_label(this_sentence)
13:     sentence = Sentence.find_by_id(sentence_id)
14:     reference_sentence = Sentence.find_by_id(reference_sentence_id)
15:     return this_sentence unless reference_sentence && sentence
16:     if this_sentence == sentence.sentence
17:       return reference_sentence.sentence
18:     elsif this_sentence == reference_sentence.sentence
19:       return sentence.sentence
20:     end
21:   end

[Source]

    # File app/models/sentence_reference.rb, line 8
 8:   def to_label
 9:     "#{sentence.sentence} ⇔ #{reference_sentence.sentence}"
10:   end

Protected Instance methods

[Source]

    # File app/models/sentence_reference.rb, line 25
25:   def authorized_for_create?
26:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_USER)
27:   end

[Source]

    # File app/models/sentence_reference.rb, line 33
33:   def authorized_for_destroy?
34:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_USER)
35:   end

[Source]

    # File app/models/sentence_reference.rb, line 37
37:   def authorized_for_read?
38:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_USER)
39:   end

[Source]

    # File app/models/sentence_reference.rb, line 29
29:   def authorized_for_update?
30:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_USER)
31:   end

[Validate]