Module: Devise::Models::Draftable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/devise_extensions/models/draftable.rb
Overview
Draftable
TODO: documentation
Instance Method Summary collapse
- #active_for_authentication? ⇒ Boolean
- #draft? ⇒ Boolean
- #finish_draft! ⇒ Object
- #not_draft? ⇒ Boolean
- #start_draft! ⇒ Object
Instance Method Details
#active_for_authentication? ⇒ Boolean
42 43 44 |
# File 'lib/devise_extensions/models/draftable.rb', line 42 def active_for_authentication? super && not_draft? end |
#draft? ⇒ Boolean
20 21 22 |
# File 'lib/devise_extensions/models/draftable.rb', line 20 def draft? is_draft end |
#finish_draft! ⇒ Object
35 36 37 38 39 40 |
# File 'lib/devise_extensions/models/draftable.rb', line 35 def finish_draft! run_callbacks :finish_draft do self.is_draft = false save end end |
#not_draft? ⇒ Boolean
24 25 26 |
# File 'lib/devise_extensions/models/draftable.rb', line 24 def not_draft? !is_draft end |
#start_draft! ⇒ Object
28 29 30 31 32 33 |
# File 'lib/devise_extensions/models/draftable.rb', line 28 def start_draft! run_callbacks :start_draft do self.is_draft = true save end end |