Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2271

callback methods ignore arguments

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.5.0
    • Affects Version/s: None
    • Component/s: None
    • None

      Using mongoid 2.4.12...

      Not sure this is actually very common, as the docs for ActiveRecords callbacks don't really talk about it at length, but they have one example at the top of the page showing this syntax:

      before_validation(:on => :create) do

      1. callback goes here
        end

      Which indicates that this should be run before the model gets validated when it is being created. I tried this, and after some testing it appears as though the callback gets fired any time the document is being validated (regardless of whether it's being created or not).

      Not a huge deal, but itt would be nice if we could use the syntax above, unless this is something that ActiveRecod doesn't truly support other than that one scenario (before_validation(:on => :create)), in which case it may not be worth the effort.

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

              Created:
              Updated:
              Resolved: