Module: MagicUserstamp::MagicColumns::ClassMethods
- Defined in:
- lib/magic_userstamp/magic_columns.rb
Instance Method Summary collapse
- #columns_with_userstamp ⇒ Object
- #ignore_userstamp(value = nil) ⇒ Object
- #setup_userstamp(columns) ⇒ Object
- #stampable_on_with_magic_columns(*args, &block) ⇒ Object
Instance Method Details
#columns_with_userstamp ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/magic_userstamp/magic_columns.rb', line 28 def columns_with_userstamp result = columns_without_userstamp unless @ignore_userstamp || @magic_columns_loaded setup_userstamp(result) @magic_columns_loaded = true end result end |
#ignore_userstamp(value = nil) ⇒ Object
18 19 20 21 |
# File 'lib/magic_userstamp/magic_columns.rb', line 18 def ignore_userstamp(value = nil) @ignore_userstamp = value unless value.nil? !!@ignore_userstamp end |
#setup_userstamp(columns) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/magic_userstamp/magic_columns.rb', line 37 def setup_userstamp(columns) config = MagicUserstamp.config columns.each do |column| next if column.primary if pattern = config.pattern_for(self, column.name) stampable_on(*pattern.args_for_stampable_on(column.name)) end end end |
#stampable_on_with_magic_columns(*args, &block) ⇒ Object
23 24 25 26 |
# File 'lib/magic_userstamp/magic_columns.rb', line 23 def stampable_on_with_magic_columns(*args, &block) ignore_userstamp(true) stampable_on_without_magic_columns(*args, &block) end |