Cannot load such file — bcrypt_ext

I had a similar problem today with ruby 2.3.3 and rails 4.2.4. The problem was that bundle install of devise installed as a dependency another version of bcrypt (bcrypt (3.1.11 x86-mingw32) instead of bcrypt (3.1.11)) which was causing trouble with ruby 2.3 (it should work with all previous versions of ruby) The solution I used is to install bcrypt … Read more

Unable to install gem – Failed to build gem native extension – cannot load such file — mkmf (LoadError)

There are similar questions: `require’: no such file to load — mkmf (LoadError) Failed to build gem native extension (mkmf (LoadError)) – Ubuntu 12.04 Usually, the solution is: sudo apt-get install ruby-dev Or, if that doesn’t work, depending on your ruby version, run something like: sudo apt-get install ruby1.9.1-dev Should fix your problem. Still not … Read more

What is the difference between Rails.cache.clear and rake tmp:cache:clear?

The rake task only clears out files that are stored on the filesystem in “#{Rails.root}/tmp/cache”. Here’s the code for that task. https://github.com/rails/rails/blob/ef5d85709d346e55827e88f53430a2cbe1e5fb9e/railties/lib/rails/tasks/tmp.rake#L25-L30 Rails.cache.clear will do different things depending on your apps setting for config.cache_store. http://guides.rubyonrails.org/caching_with_rails.html#cache-stores If you are using config.cache_store = :file_store then Rails.cache.clear will be functionally identical to rake tmp:cache:clear. However, if you’re using some other cache_store, like :memory_store or :mem_cache_store, then only Rails.cache.clear will clear your app cache. … Read more

Bundler: You must use Bundler 2 or greater with this lockfile

I had a similar experience. Here’s how I solved it Display a list of all your local gems for the bundler gem N/B: The command above is for rbenv version manager, the one for rvm might be different This will display the versions of the bundler gem installed locally Note: Your versions might differ from … Read more

Rails: Can’t verify CSRF token authenticity when making a POST request

Cross site request forgery (CSRF/XSRF) is when a malicious web page tricks users into performing a request that is not intended for example by using bookmarklets, iframes or just by creating a page which is visually similar enough to fool users. The Rails CSRF protection is made for “classical” web apps – it simply gives a degree … Read more