Class: Octodmin::Controllers::Posts::Update
- Inherits:
-
Object
- Object
- Octodmin::Controllers::Posts::Update
- Includes:
- Action
- Defined in:
- app/controllers/posts/update.rb
Instance Method Summary collapse
Instance Method Details
#call(params) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/controllers/posts/update.rb', line 14 def call(params) self.format = :json @post = Octodmin::Post.find(params.env["router.params"][:id]) halt 400, JSON.dump(errors: ["Could not find post"]) unless @post halt 400, JSON.dump(errors: ["Required params are not specified"]) unless params.valid? @post.update(params.env["rack.request.form_hash"].dup) end |