Ability to reset a field to it's default value

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • 4.0.0 final
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I'd like a way to set a field to it's default value. I've found the #apply_default method but it doesn't seem to be designed for this purpose. Specifically:

      1. It doesn't work on a field after it's been set
      2. It doesn't consider aliased fields

      What do you suggest?

      Here's the current:

          def apply_default(name)
            unless attributes.has_key?(name)
              if field = fields[name]
                default = field.eval_default(self)
                unless default.nil? || field.lazy?
                  attribute_will_change!(name)
                  attributes[name] = default
                end
              end
            end
          end
      

              Assignee:
              Unassigned
              Reporter:
              Johnny Shields
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: