Module: DraftPunk::Model::InstanceInterrogators
- Defined in:
- lib/activerecord/activerecord_instance_methods.rb
Instance Method Summary collapse
-
#has_draft? ⇒ Boolean
Whether the current ActiveRecord object has a draft version.
-
#is_draft? ⇒ Boolean
Whether the current ActiveRecord object is a draft.
-
#is_previous_version? ⇒ Boolean
Whether the current ActiveRecord object is a previously-approved version of another instance of this class.
Instance Method Details
#has_draft? ⇒ Boolean
Returns whether the current ActiveRecord object has a draft version.
200 201 202 203 |
# File 'lib/activerecord/activerecord_instance_methods.rb', line 200 def has_draft? raise DraftPunk::ApprovedVersionIdError unless respond_to?(:approved_version_id) draft.present? && !publishing_draft? end |
#is_draft? ⇒ Boolean
Returns whether the current ActiveRecord object is a draft.
194 195 196 197 |
# File 'lib/activerecord/activerecord_instance_methods.rb', line 194 def is_draft? raise DraftPunk::ApprovedVersionIdError unless respond_to?("approved_version_id") approved_version_id.present? end |
#is_previous_version? ⇒ Boolean
Returns whether the current ActiveRecord object is a previously-approved version of another instance of this class.
207 208 209 210 211 |
# File 'lib/activerecord/activerecord_instance_methods.rb', line 207 def is_previous_version? tracks_approved_version_history? && !is_draft? && current_approved_version_id.present? end |