Class: TentD::API::Posts::Destroy
- Inherits:
-
Middleware
- Object
- Middleware
- TentD::API::Posts::Destroy
- Defined in:
- lib/tentd/api/posts.rb
Instance Method Summary collapse
Methods inherited from Middleware
Methods included from Authorizable
#authorize_env!, #authorize_env?
Constructor Details
This class inherits a constructor from TentD::API::Middleware
Instance Method Details
#action(env) ⇒ Object
231 232 233 234 235 236 237 238 239 |
# File 'lib/tentd/api/posts.rb', line 231 def action(env) (env, :write_posts) if (post = TentD::Model::Post.first(:id => env.params.post_id)) && post.destroy raise Unauthorized unless post.original env.response = '' env.notify_deleted_post = post end env end |