Class: Txtblx::TextblocksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/txtblx/textblocks_controller.rb

Instance Method Summary collapse

Instance Method Details

#updateObject



3
4
5
6
7
8
9
10
11
# File 'app/controllers/txtblx/textblocks_controller.rb', line 3

def update
  @textblock = Textblock.drafts.where(perma_id: params[:id]).first!
  authorize!(:update, @textblock)

  @textblock.text = params[:textblock][:text]
  @textblock.save
  @textblock.publish
  render json: @textblock
end