Today, while I was working on my side project I needed to restrict some controllers to respond only to the JSON format. I found different solutions on internet:
class ZombiesController < BaseController
before_action :only_respond_to_json def show
@zombie = Zombie.find(params[:id])
end private def only_respond_to_json
head :not_acceptable unless params[:format] == 'json'
Now our controller will only respond to /zombies/6.json, requests sent to /zombies/6 will render a HTTP ERROR 406.
Obviously you can move the private method only_respond_to_json in your application_controller.rb to dry things up.
class ApplicationController < ActionController::Base # … private # … def only_respond_to_json head :not_acceptable unless params[:format]…
TLDR — If you want to run a version of Elasticsearch below 2.4.0 you can’t use Java 9.X, you need to downgrade to Java 8.X, Jabba can help you with that.
That’s the error I got when I ran esvm:
$ esvm 1.5.2Mar 20, 2018 6:53 PM INFO cluster Installing plugins Mar 20, 2018 6:53 PM INFO cluster Starting 1 nodes Oops TypeError: Cannot read property ‘split’ of undefined at /usr/local/lib/node_modules/esvm/node_modules/libesvm/lib/node.js:64:36 at tryCatcher (/usr/local/lib/node_modules/esvm/node_modules/bluebird/js/main/util.js:26:23) at Promise._resolveFromResolver (/usr/local/lib/node_modules/esvm/node_modules/bluebird/js/main/promise.js:480:31) at…
Note: This article is part of my project completefood.guru. If you are looking for the best soylent alternative based on your preferences, you should check it out 😙
Since recently Soylent can no longer send shipments of Soylent into Canada which can be a problem for you if you are using this product on a daily basis.
You have some solutions though:
I’m told I’m not really fun at parties.