can’t activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.1. Make sure all dependencies are added to Gemfile

In your gemfile, you aren’t specifying the version, so you’re installing the latest version of bcrypt-ruby which is 3.1.1, but what you need is any version from 3.0.0 to 3.0.9. You can get this by adding a version constraint like so: gem ‘bcrypt-ruby’, ‘~> 3.0.0′ The version requirement comes from ActiveModel’s SecurePassword which currently has … Read more

Bootstrap 3+Rails 4 – Certain Glyphicons not working

I had the same problem and found a solution. Full credit goes to Eric Minkel, who wrote a detailed blog post on the topic. I would highly suggest reading it for further reasoning. Edit app/assets/stylesheets/application.css by adding: *= require bootstrap Edit app/assets/javascripts/application.js by adding: //= require bootstrap In config/application.rb, add the following after class Application … Read more

Strange error in rails – missing helper

The problem seems to have been introduced in the latest version of ruby, ruby 2.2.0. Try this experiment: in rails console/or irb: [1] pry(main)>File.expand_path (“./”) => “/users/xxxx/Sites/xxxx” and in the terminal window: ]$ pwd /users/xxxx/sites/xxxx See the different case? If you get that, then deep in the bowels of active support a regex goes south. … Read more

Rails: How to use i18n with Rails 4 enums

Starting from Rails 5, all models will inherit from ApplicationRecord. class User < ApplicationRecord enum status: [:active, :pending, :archived] end I use this superclass to implement a generic solution for translating enums: class ApplicationRecord < ActiveRecord::Base self.abstract_class = true def self.human_enum_name(enum_name, enum_value) I18n.t(“activerecord.attributes.#{model_name.i18n_key}.#{enum_name.to_s.pluralize}.#{enum_value}”) end end Then I add the translations in my .yml file: en: … Read more

Rails 4 multiple image or file upload using carrierwave

This is solution to upload multiple images using carrierwave in rails 4 from scratch Or you can find working demo : Multiple Attachment Rails 4 To do just follow these steps. rails new multiple_image_upload_carrierwave In gem file gem ‘carrierwave’ bundle install rails generate uploader Avatar Create post scaffold rails generate scaffold post title:string Create post_attachment … Read more