Where to override current_user helper method of devise gem

According to the module Devise::Controllers::Helpers, current_user (together with all other devise helpers) is added to ApplicationController, which means that you can override it in this way: # in application_controller.rb def devise_current_user @devise_current_user ||= warden.authenticate(scope: :user) end def current_user if params[:user_id].blank? devise_current_user else User.find(params[:user_id]) end end

Couldn’t require openssl in ruby

Note: Calls to rubygems.org are deprecated – proceed with caution! I had the same issue on Mac OSX after also building ruby2.1.0p0 from the source. I already had openssl installed. It appears that the reference in gems needed refreshing. I ran: gem source -r https://rubygems.org/ to remove followed by gem source -a https://rubygems.org/ to read … Read more

Error installing Bundler

Had the same issue and everything is described here: http://railsapps.github.io/openssl-certificate-verify-failed.html tl;dr Recent versions of RVM, the Ruby Version Manager, include a utility to diagnose and resolve errors caused by outdated certificate files. See the article Installing Rails for instructions and advice. The RVM website explains how to install RVM. If you’ve installed RVM, try this: … Read more

Is there a Ruby library/gem that will generate a URL based on a set of parameters?

Yes, in Ruby’s standard library you’ll find a whole module of classes for working with URI’s. There’s one for HTTP. You can call #build with some arguments, much like you showed. http://www.ruby-doc.org/stdlib/libdoc/uri/rdoc/classes/URI/HTTP.html#M009497 For the query string itself, just use Rails’ Hash addition #to_query. i.e. uri = URI::HTTP.build(:host => “www.google.com”, :query => { :q => “test” … Read more

tech