ERROR: http://rubygems.org/ does not appear to be a repository Error fetching remote data: Errno::ETIMEDOUT

Error happens when installing gem package using proxy

$ gem install sass
ERROR: http://rubygems.org/ does not appear to be a repository
Error fetching remote data: Errno::ETIMEDOUT: Connection timed out – connect(2) (http://rubygems.org/yaml)
Falling back to local-only install
ERROR: Could not find a valid gem ‘sass’ (>= 0) in any repository

Solution:
On RHEL/Centos:=, the variable http_proxy should have value started with ‘http://’

Working:
export http_proxy=http://192.168.1.1:3128

Not working:
export http_proxy=192.168.1.1:3128

Or we can add proxy option in gem install command:
gem install –http-proxy http://192.168.1.1:3128 sass

ERROR: http://rubygems.org/ does not appear to be a repository Error fetching remote data: Errno::ETIMEDOUT

Ruby on Rails error: Both value and block given (FactoryGirl::AttributeDefinitionError)

Error: When using a callback like after(:create) or before(:create), Ruby raises this error:

Both value and block given (FactoryGirl::AttributeDefinitionError)

Cause: These callback syntaxes are supported from factory_girl 3.3.0 or above.

Solution:

Change after(:create) to after_create and before(:create) to before_create

Or Upgrade factory_girl to version >=3.3.0

Ruby on Rails error: Both value and block given (FactoryGirl::AttributeDefinitionError)

Ruby on Rails Notice: The native BSON extension was not loaded.

Error: When using mongo gem in RoR:

Notice: The native BSON extension was not loaded. For optimal performance, use of the BSON extension is recommended. To enable the extension make sure ENV[‘BSON_EXT_DISABLED’] is not set and run the following command: gem install bson_ext

Cause:

bson_ext and mongo gem are not in the same version.

Solution: Install bson_ext and mongo gems using the same version, example: 1.9.2:

gem install mongo -v=1.9.2
gem install bson_ext -v=1.9.2
Ruby on Rails Notice: The native BSON extension was not loaded.

Unable to activate mongo-1.12.0, because bson-2.3.0 conflicts with bson (= 1.12.0)

Error: Unable to activate mongo-1.12.0, because bson-2.3.0 conflicts with bson (= 1.12.0) when installing both ruby gem mongo and mongoid

Cause: mongo gem requires bson 1.12.0 while mongoid version > 3.0.0 requires moped which needs bson 2.3.0

Solution: Use mongoid < 2.8.1 if you want to use mongo, or dump mongo and switch to moped:

gem install mongoid -v 2.8.1

Unable to activate mongo-1.12.0, because bson-2.3.0 conflicts with bson (= 1.12.0)