Module: VestalVersions::Versioned
- Defined in:
- lib/vestal_versions/versioned.rb
Overview
Simply adds a flag to determine whether a model class if versioned.
Class Method Summary collapse
-
.extended(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#versioned? ⇒ Boolean
For all ActiveRecord::Base models that do not call the
versioned
method, theversioned?
method will return false. -
#versioned_with_flag(*args) ⇒ Object
Overrides the
versioned
method to first define theversioned?
class method before deferring to the originalversioned
.
Class Method Details
.extended(base) ⇒ Object
:nodoc:
4 5 6 7 8 9 10 |
# File 'lib/vestal_versions/versioned.rb', line 4 def self.extended(base) # :nodoc: base.class_eval do class << self alias_method_chain :versioned, :flag end end end |
Instance Method Details
#versioned? ⇒ Boolean
For all ActiveRecord::Base models that do not call the versioned
method, the versioned?
method will return false.
26 27 28 |
# File 'lib/vestal_versions/versioned.rb', line 26 def versioned? false end |
#versioned_with_flag(*args) ⇒ Object
Overrides the versioned
method to first define the versioned?
class method before deferring to the original versioned
.
14 15 16 17 18 19 20 21 22 |
# File 'lib/vestal_versions/versioned.rb', line 14 def versioned_with_flag(*args) versioned_without_flag(*args) class << self def versioned? true end end end |