Sha256: 68a879aed811105c6a47d690f0ca56dfb06fbb3bffe5d72bb1e9eb3696bcd707
Contents?: true
Size: 1.59 KB
Versions: 3
Compression:
Stored size: 1.59 KB
Contents
# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'active_support/concern' require 'active_model/observing' module Ripple module Observable extend ActiveSupport::Concern include ActiveModel::Observing included do set_callback(:create, :before) { notify_observers :before_create } set_callback(:create, :after) { notify_observers :after_create } set_callback(:update, :before) { notify_observers :before_update } set_callback(:update, :after) { notify_observers :after_update } set_callback(:save, :before) { notify_observers :before_save } set_callback(:save, :after) { notify_observers :after_save } set_callback(:destroy, :before) { notify_observers :before_destroy } set_callback(:destroy, :after) { notify_observers :after_destroy } set_callback(:validation, :before) { notify_observers :before_validation } set_callback(:validation, :after) { notify_observers :after_validation } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ripple-0.9.5 | lib/ripple/observable.rb |
ripple-0.9.3 | lib/ripple/observable.rb |
ripple-0.9.2 | lib/ripple/observable.rb |