Why does my `require` statement cause a LoadError?

I’ve installed the money gem: $ gem install money Successfully installed money-6.0.1 1 gem installed Installing ri documentation for money-6.0.1… Installing RDoc documentation for money-6.0.1… After installing, I started an IRB session and tried to load it using require “money”, but I got a LoadError: LoadError: no such file to load — money from (irb):1:in […]

After installing Ruby 2.3.1, I cannot install any Gems on Win10: SSL error

After installing Ruby 2.3.1 x64, I cannot install any Gems on Win10 because of a SSL error. I found lots of articles on the net about how to fix it but none of them work. Where is the source of truth! C:\Users\djangofan>gem install rubygems-update ERROR: Could not find a valid gem ‘rubygems-update’ (>= 0), here […]

Why can't I require a gem from within the .gemspec?

I can’t require third party code in my .gemspec file. I would like to require a semver library to manage my version number. Why can’t I require gems inside my .gemspec? I have a workaround for my particular problem. What I am interested in the specific reason I can’t require code from inside a gemspec. […]

Ruby not recognizing Grackle object/plugin (Twitter API wrapper) — “NameError: uninitialized constant Grackle”

The very first line of this program is where the error happens, require ‘grackle’ This is code I wrote this morning while I was in class and with the entire program (which starts with ‘require grackle’) I was able to read tweets and write them directly from the command line. Now I get home and […]

Getting output of system() calls in Ruby

If I call a command using Kernel#system in Ruby, how do I get its output? system(“ls”)

Can't install the pg gem

On Mac OS X 10.6.8, I get the following error when trying gem install pg. Trying to push my Rails website to Heroku. A pretty standard install of Ruby 1.9.3p194. $ cat /Users/me/.rvm/gems/ruby-1.9.3-p194\@ucode/gems/pg-0.15.1/ext/gem_make.out /Users/me/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb checking for pg_config… no No pg_config… trying anyway. If building fails, please try again with –with-pg-config=/path/to/pg_config checking for libpq-fe.h… no […]

Unable to identify the object from ruby library

I recently updated the OS to ELcaptain and ever since my feature files are failing and not identifying object. This is the error I get in terminal when I run a file: cannot load such file — rspec (LoadError) /Users/xyz/.rvm/rubies/ruby-2.1.6/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in `require’ /Users/xyz/.rvm/rubies/ruby-2.1.6/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require’ /Users/xyz/.rvm/rubies/ruby-2.1.6/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:39:in `require’ /Users/xyz/ttv-cucumber/helper/auto_loader.rb:14:in `<top (required)>’ /Users/xyz/ttv-cucumber/flow-combo-selection/features/support/common.rb:1:in `require_relative’ /Users/xyzr/ttv-cucumber/flow-combo-selection/features/support/common.rb:1:in `<top (required)>’ […]

Getting “Invalid multibyte char (US-ASCII)” when requiring file in Ruby

This question has been added already, but my case seems a little different. Machine: Windows Server 2012 Ruby: Version 1.9.3 p484 I have my main ruby file file1.rb: module Sass::Script::Functions def dosome() # Doing some stuff begin success = require_relative ‘myfile2.rb’ rescue Exception => e puts “Error: #{e.message} – #{e.backtrace}!” end end end This is […]

Why am I getting objects printed twice?

When I am in irb or in rails and I create some iteration with each, I am getting the whole struct printed again in my terminal or inside the browser. Example: a = [1,2,3,4] a.each do |number| puts n end The result in irb terminal or inside the browser: 1 2 3 4 => [1,2,3,4] […]

What do you call the &: operator in Ruby?

Possible Duplicates: Ruby/Ruby on Rails ampersand colon shortcut What does map(&:name) mean in Ruby? I was reading Stackoverflow and stumbled upon the following code array.map(&:to_i) Ok, it’s easy to see what this code does but I’d like to know more about &: construct which I have never seen before. Unfortunately all I can think of […]

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