Sha256: 61cd9b0806b147b60d58c0174999bb16f8aa83de7f63dd3db62f3078e4eede17

Contents?: true

Size: 281 Bytes

Versions: 3

Compression:

Stored size: 281 Bytes

Contents

module Octodmin::Controllers::Posts
  class Show
    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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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