Class LanguageCharacterAttribute
In: app/models/language_character_attribute.rb
Parent: ActiveRecord::Base

Methods

Constants

ATTRIBUTE_FREQUENCY = 'freq'
ATTRIBUTE_STROKE_COUNT = 'stroke_count'
ATTRIBUTE_GRADE = 'grade'
ATTRIBUTE_JLPT = 'jlpt'

Public Class methods

[Source]

    # File app/models/language_character_attribute.rb, line 10
10:   def self.attributes
11:     unless @@attributes
12:       @@attributes = Array.new
13:       @@attributes << ATTRIBUTE_FREQUENCY
14:       @@attributes << ATTRIBUTE_STROKE_COUNT
15:       @@attributes << ATTRIBUTE_GRADE
16:       @@attributes << ATTRIBUTE_JLPT
17:     end
18:     return @@attributes
19:   end

Public Instance methods

[Source]

    # File app/models/language_character_attribute.rb, line 21
21:   def to_label
22:     I18n.t("activerecord.attributes.language_character_attribute.#{language.iso_639_code}.#{entity}.#{attribute}")
23:   end

Protected Instance methods

[Source]

    # File app/models/language_character_attribute.rb, line 27
27:   def authorized_for_create?
28:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_ADMIN)
29:   end

[Source]

    # File app/models/language_character_attribute.rb, line 35
35:   def authorized_for_destroy?
36:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_ADMIN)
37:   end

[Source]

    # File app/models/language_character_attribute.rb, line 39
39:   def authorized_for_read?
40:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_USER)
41:   end

[Source]

    # File app/models/language_character_attribute.rb, line 31
31:   def authorized_for_update?
32:     return Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_ADMIN)
33:   end

[Validate]