Module: ActionDraft::Attribute

Extended by:
ActiveSupport::Concern
Defined in:
lib/action-draft/attribute.rb

Instance Method Summary collapse

Instance Method Details

#publishObject



11
12
13
14
15
16
17
# File 'lib/action-draft/attribute.rb', line 11

def publish
  self.action_draft_attributes ||= []
  self.action_draft_attributes.each do |_name|
    self.send("#{_name}=", self.send("draft_#{_name}").to_s)
  end
  self.save
end

#publish!Object



19
20
21
# File 'lib/action-draft/attribute.rb', line 19

def publish!
  publish ? true : raise_validation_error
end