[Feature request] Allow change of default value for fields in inherited model

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • 5.1.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hello,

      Would it be possible to add an easy way to change a field default value outside the field definition?

      Pseudo code:

      class SomeDocument
      include Mongoid::Document
      field :data, :type => String, :default => 'I love mongoid'
      end

      class BetterDocument < SomeDocument
      default_value_for :data, 'Mongoid loves me'
      end

      at the moment, the way I use which generates a warning is

      class SomeDocument
      include Mongoid::Document
      field :data, :type => String, :default => 'I love mongoid'
      end

      class BetterDocument < SomeDocument
      field :data, :type => String, :default => 'Mongoid loves me'
      end

              Assignee:
              Unassigned
              Reporter:
              Olivier Milla
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: