Class: Coderberry::Utils
- Inherits:
-
Object
- Object
- Coderberry::Utils
- Defined in:
- lib/coderberry/utils.rb
Instance Method Summary collapse
Instance Method Details
#active_record_callbacks(klass) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/coderberry/utils.rb', line 4 def active_record_callbacks(klass) klass.__callbacks.each_with_object(Hash.new([])) do |(k, callbacks), result| next if k == :validate # ignore validations callbacks.each do |c| # remove autosaving callbacks from result next if c.filter.to_s.include?("autosave") next if c.filter.to_s.include?("_ensure_no_duplicate_errors") result["#{c.kind}_#{c.name}"] += [c.filter] end end end |