Class: CustomFieldValue
- Inherits:
-
Object
- Object
- CustomFieldValue
- Defined in:
- app/models/custom_field_value.rb
Overview
Redmine - project management software Copyright (C) 2006-2016 Jean-Philippe Lang
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Instance Attribute Summary collapse
-
#custom_field ⇒ Object
Returns the value of attribute custom_field.
-
#customized ⇒ Object
Returns the value of attribute customized.
-
#value ⇒ Object
Returns the value of attribute value.
-
#value_was ⇒ Object
Returns the value of attribute value_was.
Instance Method Summary collapse
- #custom_field_id ⇒ Object
- #editable? ⇒ Boolean
-
#initialize(attributes = {}) ⇒ CustomFieldValue
constructor
A new instance of CustomFieldValue.
- #required? ⇒ Boolean
- #to_s ⇒ Object
- #true? ⇒ Boolean
- #validate_value ⇒ Object
- #visible? ⇒ Boolean
Constructor Details
#initialize(attributes = {}) ⇒ CustomFieldValue
Returns a new instance of CustomFieldValue
21 22 23 24 25 |
# File 'app/models/custom_field_value.rb', line 21 def initialize(attributes={}) attributes.each do |name, v| send "#{name}=", v end end |
Instance Attribute Details
#custom_field ⇒ Object
Returns the value of attribute custom_field
19 20 21 |
# File 'app/models/custom_field_value.rb', line 19 def custom_field @custom_field end |
#customized ⇒ Object
Returns the value of attribute customized
19 20 21 |
# File 'app/models/custom_field_value.rb', line 19 def customized @customized end |
#value ⇒ Object
Returns the value of attribute value
19 20 21 |
# File 'app/models/custom_field_value.rb', line 19 def value @value end |
#value_was ⇒ Object
Returns the value of attribute value_was
19 20 21 |
# File 'app/models/custom_field_value.rb', line 19 def value_was @value_was end |
Instance Method Details
#custom_field_id ⇒ Object
27 28 29 |
# File 'app/models/custom_field_value.rb', line 27 def custom_field_id custom_field.id end |
#editable? ⇒ Boolean
35 36 37 |
# File 'app/models/custom_field_value.rb', line 35 def editable? custom_field.editable? end |
#required? ⇒ Boolean
43 44 45 |
# File 'app/models/custom_field_value.rb', line 43 def required? custom_field.is_required? end |
#to_s ⇒ Object
47 48 49 |
# File 'app/models/custom_field_value.rb', line 47 def to_s value.to_s end |
#true? ⇒ Boolean
31 32 33 |
# File 'app/models/custom_field_value.rb', line 31 def true? self.value == '1' end |
#validate_value ⇒ Object
55 56 57 58 59 |
# File 'app/models/custom_field_value.rb', line 55 def validate_value custom_field.validate_custom_value(self).each do || customized.errors.add(:base, custom_field.name + ' ' + ) end end |
#visible? ⇒ Boolean
39 40 41 |
# File 'app/models/custom_field_value.rb', line 39 def visible? custom_field.visible? end |