Sha256: 2fba0d780b861b832832050000c2d4ab79a6a9ebfb366d76de611c06a182cb2c

Contents?: true

Size: 303 Bytes

Versions: 3

Compression:

Stored size: 303 Bytes

Contents

module Octodmin::Controllers::Posts
  class Destroy
    include Octodmin::Action
    expose :post

    def call(params)
      self.format = :json

      @post = Octodmin::Post.find(params[:id])
      halt 400, JSON.dump(errors: ["Could not find post"]) unless @post
      @post.delete
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
octodmin-0.2.1 app/controllers/posts/destroy.rb
octodmin-0.2.0 app/controllers/posts/destroy.rb
octodmin-0.1.0 app/controllers/posts/destroy.rb