Sha256: f11052f33b4c52f053b3fd357bf2cfdd9e9c6848106c2c914d50e9a5de3b3438

Contents?: true

Size: 304 Bytes

Versions: 3

Compression:

Stored size: 304 Bytes

Contents

module Octodmin::Controllers::Posts
  class Restore
    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.restore
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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