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
5
votes
1 answer

Circular dependency detected while autoloading constant (Rails 4, Ruby 2)

configs/routes.rb Shutters and Paints are subresources of Jobs. resources :jobs do resources :shutters resources :paints end app/models/job.rb A Job contains many Shutters and many Paints. class Job < ActiveRecord::Base has_many…
dpyro
  • 1,559
  • 2
  • 13
  • 19
5
votes
1 answer

Travis CI No Binary for 2.1.0 Found

I've just updated a gem to run its tests with Ruby 2.1.0, but it seems that there is no binary on Travis. I've been looking around the internet and can't find anything definitive. Here is a link to the build:…
mhgbrown
  • 91
  • 6
5
votes
1 answer

Bundler could not find compatible versions for gem "activemodel"

Trying to install mongoid 3.1.6 in rails 4.1 Bundler could not find compatible versions for gem "activemodel": In Gemfile: mongoid (~> 3.1.6) ruby depends on activemodel (~> 3.2) ruby rails (= 4.1.0) ruby depends on activerecord (= 4.1.0)…
Mothirajha
  • 1,033
  • 1
  • 10
  • 18
5
votes
1 answer

Rails Upgraded syntax error, unexpected '\n', expecting => (SyntaxError)

I have this query has_many :unused_invitations, :class_name => 'Invitation', :foreign_key => 'inviter_id', :conditions => 'used = false' I was using rails 3.2.17 and now I am upgrading to rails 4.0.4. I got this error DEPRECATION WARNING: The…
Amrit Dhungana
  • 4,371
  • 5
  • 31
  • 36
5
votes
1 answer

Rubymine cant change Language Level | Updated to Ruby 2.1.1

I am using Rubymine 5.4 and just updated to Ruby 2.1.1. I changed the Ruby SDK (Settings/Ruby SDK and Gems) but the Language level is at 1.8 and i cant change it. now all my files got error'd out like action: 'Show' isn't accepted anymore with the…
Mini John
  • 7,855
  • 9
  • 59
  • 108
5
votes
1 answer

Ruby 2.0.0, not 2.1.0 recommendation on Rails site?

At time of writing, on the Ruby on Rails download page, they recommend using Ruby 2.0.0 with Rails. Ruby 2.1.0 was released at the end of December 2013. Is that recommendation out of date? Do you have any tales of woe or joy about running Rails 4.0…
Eliot Sykes
  • 9,616
  • 6
  • 50
  • 64
5
votes
2 answers

Ruby 2.1.0 on existing Heroku application

I got very weird problem with setting Ruby version to 2.1.0 on extisting Heroku app. When trying to deploy, got this error: ! Invalid RUBY_VERSION specified: ruby-2.1.0 ! Valid versions: ruby-2.0.0, ruby-1.9.3, ruby-1.9.2, ruby-1.8.7,…
methyl
  • 3,272
  • 2
  • 25
  • 34
4
votes
1 answer

Rails 4 add new column or field in model

I try to add new column into existing model in rubyonrails. How can I add single or multiple field into my existing model.
user4478911
4
votes
1 answer

Ruby prawn-table gem : How to select last row of a table?

I have a prawn table like the following: table info_rows do row(0).font_style = :bold row(0).align = :center row(0).borders = [:top, :bottom, :left, :right] row(1..50).borders = [:left, :right] self.header = true self.row_colors =…
polarcare
  • 575
  • 1
  • 6
  • 24
4
votes
2 answers

DBI Row / delegate behavior between ruby 1.8.7 and 2.1

I execute the following code in ruby 1.8.7 to read rows from my database: require 'dbi' db_conn_handle = DBI.connect("DBI:Mysql:host=localhost;database=mydb;port=3306", "root") sth = db_conn_handle.prepare("select accounts.id, accounts.name from…
Rajat
  • 1,766
  • 2
  • 21
  • 42
4
votes
3 answers

Array#to_s in Ruby 2.1 broke my code

This code broke on Ruby 2.1 class Test def to_s() "hi" end end puts [Test.new(), Test.new()].to_s Ruby 1.9.3: $ ruby --version ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux] $ /opt/chef/embedded/bin/ruby test.rb [hi, hi] Ruby…
omribahumi
  • 2,011
  • 1
  • 17
  • 19
4
votes
0 answers

Using rails-perftest with Rails 4.1 and Ruby 2.1

In Railscasts 411 Performance Testing http://railscasts.com/episodes/411-performance-testing Ryan has us patch the garbage collector in our version Ruby. He's using Ruby 1.9.3. Is this still required for Ruby 2.1.1, with its new garbage collector?…
linojon
  • 1,052
  • 1
  • 10
  • 19
4
votes
3 answers

How can I get named parameters into a Hash?

I want to have named parameters to a method so the API is clear to the caller, but the implementation of the method needs the named parameters in a hash. So I have this: def my_method(required_param, named_param_1: nil, named_param_2: nil) …
Max Schmeling
  • 12,363
  • 14
  • 66
  • 109
4
votes
1 answer

Native extension error installing JSON gem

I've set up the Brightbox Ruby 2.1.0 apt package and encountering a native compilation error installing json package. $ sudo gem install json -v '1.8.1' Fetching: json-1.8.1.gem (100%) Building native extensions. This could take a while... ERROR:…
mahemoff
  • 44,526
  • 36
  • 160
  • 222
3
votes
0 answers

Ruby installation (2.1.2) fails in macOS Big Sur(11.2.3)

I am not able to install ruby 2.1.2 on MacBook Pro (16-inch, 2019). I am getting below issue Downloading ruby-2.1.2.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2 Installing ruby-2.1.2... WARNING: ruby-2.1.2 is past its…
sgk
  • 159
  • 1
  • 13
1 2
3
14 15