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

Rescue Exception to overcome gem error?

I am trying to use the pusher-client gem to receive a Pusher from a website (near real-time data). However, the script tends to die a lot. If I post the Pusher data to my screen, then the client runs for as long as I care to let it run. However, if…
Gabe Spradlin
  • 1,937
  • 4
  • 23
  • 47
0
votes
0 answers

Rails, form_for is updating attribute on all model records, not just the attribute belonging to the instance

I have created a view for volunteers to sign up for specific shifts. I am able to write my view and controller for shifts so that, when the form_for submit button is clicked, the current_user.id is pushed onto the specific shift's user_ids…
0
votes
1 answer

The short name of a USA state by its full name (the gems countries and country_select)

I'm using 2 gems for the countries and their states (the USA and Canada): gem "countries" gem "country_select" Say I'm using only USA for simplicity and I have the state California. I want to get the short name for it which is CA. I can do this by…
Incerteza
  • 32,326
  • 47
  • 154
  • 261
0
votes
3 answers

Array to Hash with conditional logic in Ruby?

ruby 2.1.1 Is there a way to do the logic in this piece of code in one line or a more concise manner? user = User.new h = Hash.new attrs = [:name, :foo, :bar] attrs.each do |a| h[a] = user[a] if user.has_attribute? a end return h
Derek
  • 11,980
  • 26
  • 103
  • 162
0
votes
1 answer

bash script unable to automate installing ruby with rbenv and ruby build

The shell script below runs without error but when it finishes , I discovered that it only ran the first part of the script that installs rbenv but doesn't call all the lines from echo "========= Cloning ruby build =========" till the end. I am…
brg
  • 3,915
  • 8
  • 37
  • 66
0
votes
1 answer

Built a RoR app previously with Ruby 1.9.3, if I use a new computer and install Ruby 2.1.2 will that cause problems?

I have an RoR app built previously with Ruby 1.9.3 and rails 3.0.1. I have deployed to Heroku previously with this setup. If I would like to use Ruby 2.1.2 on my new computer, when accessing the app code and trying to deploy again on Heroku will my…
trying_hal9000
  • 4,343
  • 8
  • 43
  • 62
0
votes
0 answers

Heroku deployment error "Page doesn't exist"

I am trying to deploy to Heroku but am getting the dreaded "The page you were looking for doesn't exist." error on all pages. After reading similar issues, I've checked my routes file but all looks okay to me. Here's what I have: Gemfile: source…
Khundawg
  • 17
  • 1
  • 6
0
votes
1 answer

How to set date interpretation/format?

I am dynamically updating the underlying model by passing the parameters from the posted form to the model like this: @model.assign_attributes(params[:model]) I have a date coming in along with the rest of the post data in the format mm/dd/yyyy.…
Josh M.
  • 26,437
  • 24
  • 119
  • 200
0
votes
2 answers

Running Redmine with ruby 2.1.1

I have installed ruby 2.1.1 using rvm after root login. In another user login ruby 1.8.7 is in use. with 1.8.7 Redmine 2.5.0 works fine. but with 2.1.0 command: ruby script/rails server webrick -d -e…
Dax Joshi
  • 143
  • 11
0
votes
1 answer

How to change Rails 3 to_xml encoding

Im using Rails 3 to_xml on a Model with a few options like include, except and methods. So this is not my first time using to_xml. I'm doing something like this: to_xml(include: { order: { methods: [:my_avg], except: [:this_attr,…
AndreDurao
  • 5,600
  • 7
  • 41
  • 61
0
votes
2 answers

Ruby greater than operand weird behaviour

Can someone please explain me why this can be happening $ irb 2.1.1 :001 > "9" > "3" => true 2.1.1 :002 > "10" > "3" => false 2.1.1 :005 > "2.3" > "2.1" => true 2.1.1 :003 > Why is "10" > "3" returning false ?
AnkitG
  • 6,438
  • 7
  • 44
  • 72
0
votes
2 answers

Unwanted hash prints in Rails 4

I have a friendship model that is working but when I include this code in my user/show view, I get this unwanted result: Friends Dave Olson, accepted [#
Dave Olson
  • 252
  • 3
  • 13
0
votes
3 answers

Ruby block returning inappropriate value

Following up this screencast, and its someway returning 2..3 instead if Product records def save puts "--- imported_products: #{imported_products.inspect}" // --- imported_products: 2..3 if imported_products.map(&:valid?).all? …
user2931706
0
votes
0 answers

Install GSL gem with Ruby 2.1 Debian/Ubuntu

I tried so many times, reading a lot for everywhere, but I can't install the gem with ruby 2.1, I'm currently using it with Ruby 2.0 + GSL 1.15 + GSL gem 1.15.3 + Debian 7.0 (wheezy) Can someone share his recipe. Thanks in advance.
Shinta
  • 256
  • 2
  • 12
0
votes
0 answers

rSpec - How to write a failing test for a model column

Im trying to develop my app using TDD so I need to write a failing test first for a database column. However, when I add content to a non-existent field in a model it seems to get assigned anyway. I don't know how to make this test fail. Ruby 2.1.1,…
jbmoon
  • 129
  • 1
  • 11
1 2 3
14
15