Why is it bad style to `rescue Exception => e` in Ruby?

Ryan Davis’s Ruby QuickRef says (without explanation): Don’t rescue Exception. EVER. or I will stab you. Why not? What’s the right thing to do?

How to count total points of a user using Gioco gem's methods

I want to know that how can we find the total points earned by a user. I am using gioco gem in my Ruby on Rails application. I can add badges and points but when I add points to user’s table it makes new entry to it. but how can we count the total points. […]

error: undefined method `gsub' for nil:NilClass

All I did was try to follow the instructions on Jekyll’s site. I got an error that I don’t know how to fix. ~ $ gem install jekyll ~ $ jekyll new my-awesome-site ~ $ cd my-awesome-site When I got the error: error: undefined method `gsub’ for nil:NilClass. Use –trace to view backtrace Trace results: […]

Rails Gemes versions and the `Gemfile` compiled have problems?

I have a very big project developed in certain test version, the project run well, but there are a problem with the rspec, the Gemfile and the Gemfile.lock, some of the developers have updated some gems but didn’t remove the old Gemfile.lock, so we did not had any problem with the project because the Gemfile […]

Wrapping a set of stylesheets and javascript in a Ruby Gem with post build step to drop into right place

We have a very complex library for styles and scripts that is maintained by a collaborative team. This code is a large set of less, javascript, font and image files that is built using grunt and a number of modules installed with NPM. What I want to do is have a post operation step in […]

Rails 4: Not able to require Bootstrap

I am following Tuts+ tutorial on “Building a Polling Application in Rails”. I have followed along with every foundational step to configure the app. With the ‘bootsrap-sass’ gem installed, he simply adds the *= require bootstrap to the application.css file and instantly sees the changed results on his server. However, I receive the following error.. […]

Testing modules in rspec

What are the best practices on testing modules in rspec? I have some modules that get included in few models and for now I simply have duplicate tests for each model (with few differences). Is there a way to DRY it up?

Equivalent of cURL for Ruby?

Is there a cURL library for Ruby?

Is there a command in Rails that installs all your gems and dependencies?

I am learning Ruby on Rails and I find it annoying having to install and worry about gems and other dependencies for the apps I build . Does Rails have a way to install all your gems and dependencies for you ?

Array#each vs. Array#map

hash = { “d” => [11, 22], “f” => [33, 44, 55] } # case 1 hash.map {|k,vs| vs.map {|v| “#{k}:#{v}”}}.join(“,”) => “d:11,d:22,f:33,f:44,f:55” # case 2 hash.map {|k,vs| vs.each {|v| “#{k}:#{v}”}}.join(“,”) => “11,22,33,44,55” only difference is case 1 uses vs.map, case 2 uses vs.each. What happened here?

Ruby is the best programming language in the world - Ruby on Rails.