Questions tagged [ruby-2.1]

For issues relating to development in Ruby, version 2.1. If your question applies to Ruby in general, use the tag [tag:ruby].

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. Ruby 2.1 was released on Dec 25, 2013.

For information on Ruby in general, visit .

222 questions
59
votes
8 answers

Check whether a string contains one of multiple substrings

I've got a long string-variable and want to find out whether it contains one of two substrings. e.g. haystack = 'this one is pretty long' needle1 = 'whatever' needle2 = 'pretty' Now I'd need a disjunction like this which doesn't work in Ruby…
Hedge
  • 16,142
  • 42
  • 141
  • 246
48
votes
5 answers

Can I have required named parameters in Ruby 2.x?

Ruby 2.0 is adding named parameters, like this: def say(greeting: 'hi') puts greeting end say # => puts 'hi' say(greeting: 'howdy') # => puts 'howdy' How can I use named parameters without giving a default value, so that…
Nathan Long
  • 122,748
  • 97
  • 336
  • 451
35
votes
3 answers

Ruby - Digest::Digest is deprecated; Use Digest

I've been getting this warning whenever I run my tests or start rails server. When I run grep from .rvm folder I see the following: grep -R 'Digest::Digest' . ./rubies/ruby-2.1.0/lib/ruby/2.1.0/openssl/digest.rb: warn('Digest::Digest is deprecated;…
stephenmurdoch
  • 34,024
  • 29
  • 114
  • 189
30
votes
3 answers

AWS Elastic Beanstalk - How To Upgrade Existing Environment from Ruby 2.1 to Ruby 2.2

AWS Elastic Beanstalk - Cannot Clone With Latest Platform or eb upgrade from Ruby 2.1 to Ruby 2.2 I've been smashing my head on this one. Back in May, AWS announced that their Ruby Elastic Environments now offer Ruby-2.2 (e.g.…
Dan
  • 1,955
  • 17
  • 21
26
votes
4 answers

Debugger gem not supported in Ruby 2.1.0 / 2.1.1 / 2.1.2

I just upgraded my RVM Ruby installation to version 2.1.0 and tried to bundle install when I got the following error: Gem::Ext::BuildError: ERROR: Failed to build gem native extension. Ruby version 2.1.0 is not supported. *** extconf.rb failed…
Severin
  • 8,508
  • 14
  • 68
  • 117
16
votes
2 answers

Memory usage increase with Ruby 2.1 versus Ruby 2.0 or 1.9

I recently deployed an upgrade of Ruby from 2.0 to 2.1.5 to my Heroku web application, and I am consistently hitting memory quota errors now, whereas with 2.0 and 1.9 this never happened. There is a limit of 512MB for a normal Heroku Dyno, and I am…
Matthew O'Riordan
  • 7,981
  • 4
  • 45
  • 59
16
votes
2 answers

Bundler fails to install debugger 1.6.8

I have tried looking at some of these answers, but nothing seems to work. Here is the error. funk@funktop ~/rails_projects/hearingtracker $ gem install debugger -v '1.6.8' Fetching: columnize-0.8.9.gem (100%) Successfully installed…
Abram
  • 39,950
  • 26
  • 134
  • 184
14
votes
5 answers

Fix for: Prior to 0.1.6, libyaml is vulnerable to a heap overflow exploit from malicious YAML payloads

I get the following error when running rspec after I added the vcr gem. Simply running gem install psych -- --enable-bundled-libyaml as suggested doesn't solve the problem. I am using rbenv and ruby-build and I am on ruby 2.1.1. What do i have to do…
Dominik Goltermann
  • 4,276
  • 2
  • 26
  • 32
14
votes
1 answer

How to uninstall rvm, ruby, rails and gems. I'm getting errors on Mavericks

I'm new on Ruby on Rails and I have some problems with configuration. I don't know what to do. I installed many times ruby, rails and Gems because report problems. I read a lot of questions on stack overflow and nothing for solve. I try now…
rld
  • 2,603
  • 2
  • 25
  • 39
14
votes
2 answers

Why would `rvm install ruby-2.1.0` install preview1?

I just tried to install Ruby 2.1, and instead got 2.1 Preview 1. This seems crazy to me. 2.1 is out. Why would RVM assume that when I say rvm install ruby-2.1.0 that I really mean rvm install ruby-2.1.0-preview1? Why would it not match the exact…
iconoclast
  • 21,213
  • 15
  • 102
  • 138
13
votes
4 answers

Rails: Disabling link_to link not working but hidden link_to working

The link_to method is as which is not disabled:- <%= link_to edit_cabinet_path(object), remote: true, disabled: true do %> <% end %> but if i do like below which hides the link <%=…
codemilan
  • 1,072
  • 3
  • 12
  • 32
10
votes
2 answers

How to refine module method in Ruby?

You can refine your class with module RefinedString refine String do def to_boolean(text) !!(text =~ /^(true|t|yes|y|1)$/i) end end end but how to refine module method? This: module RefinedMath refine Math do def PI …
Filip Bartuzi
  • 5,711
  • 7
  • 54
  • 102
10
votes
2 answers

Strings that compare equal don't find same objects in Hash

I have two strings that appear equal: context = "Marriott International World’s Most ADMIRED Lodging Company by FORTUNE for 14th yr. via @FortuneMagazine http://cnnmon.ie/1kcFZSQ" slice_str = context.slice(105,24) # => "http://cnnmon.ie/1kcFZSQ" str…
Rich Sutton
  • 10,004
  • 1
  • 17
  • 21
9
votes
2 answers

Attribute saved in development but not in production

I have the following helper method: def parse_potential_followers(params) t_id = TestSet.where(:test_name => params[:test_set][:test_name]).pluck(:id)[0].to_i screen_names = params[:potential_followers].first[1].split("\n").reject(&:blank?) …
9
votes
2 answers

nginx: [emerg] invalid number of arguments in "passenger_root" directive

I'm trying to set up for the first time with Rubber onto EC2 (complete_passenger_nginx_postgresql). I changed a bunch of settings in the config files to make it work with a different AMI (Ubuntu 12.04.3 LTS - ami-a73264ce (64-bit)), Ruby 2.1.0,…
Ben
  • 2,957
  • 2
  • 27
  • 55
1
2 3
14 15