Questions tagged [ruby-2.2]

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

For issues relating to development in Ruby, version 2.2. It was released on December 2014. You can check the official docs here.

If your question applies to Ruby in general, use the tag .

119 questions
1
vote
2 answers

Having column with decimal type with 2 precision. But while save data in it, It saves value with only one precision.

I am using Ruby 2.2.4 and PostgreSQL. I have created migration: add_column :plans, :price, :decimal, precision: 7, scale: 2 When I am going to create new record, it will save value in price column with only one precision. Why it happens? I want…
unnati patil
  • 1,601
  • 2
  • 13
  • 12
1
vote
1 answer

moving rails2 to 4 and getting error - undefined method `with_scope'

How to replace this Query in rails4.1.9 AuditArea.send(query_options[:include_retired] ? :with_exclusive_scope : :with_scope) { # some stuff } Getting Error undefined method `with_scope' .
1
vote
3 answers

Replace video tags from HTML string

The HTML string is: "
\r\n
1
vote
0 answers

Ruby 2.2.4 on Openshift Online without Docker

I'm using Openshift Online (bronze) to host a rails app and I'd like to upgrade from the standard Ruby 2.0 cartridge to Ruby 2.2.4 so that I can run Rails 5. I tried following this tutorial Using Openshift S2I docker images to build ruby application…
stephenmurdoch
  • 34,024
  • 29
  • 114
  • 189
1
vote
0 answers

Error with Phusion passenger + Nginx for spawning the new application process

My application is based on Ruby 2.2.0, Rails 4.1.9, nginx 1.8.0, Phusion Passenger - 5.0.11 and the application is deployed on EC2 instance, 2 cores and 8GB RAM. But sometimes it shows me following error in the log file: stderr: Errno::ENOMEM App…
Deepti Kakade
  • 3,053
  • 3
  • 19
  • 30
1
vote
2 answers

How to generate a unique random id for post in Ruby on Rails 4?

I want to produce unique post identifier for posts in my blogging application. Currently I am using SecureRandom.hex(10) for generating unique post identifier for my blogging site but I am not sure is it safe SecureRandom for this purpose. Is there…
Mr94
  • 143
  • 1
  • 15
1
vote
1 answer

Ruby 2 and Rails 4 encoding issue

I'm working on a project that is migrating from a rails 3.2 and ruby 1.9.x to ruby 2.2.x and rails 4.2.4 version. When the project goes to production server, it started to throw encoding errors like this: "\xC3" from ASCII-8BIT to UTF-8 followed by…
Kleber S.
  • 8,110
  • 6
  • 43
  • 69
1
vote
0 answers

Rounding issues with complex numbers in Ruby

In IRB (using Ruby version 2.2), if I try getting the square root of -1 by raising it to the power of 0.5, I get strange results: (-1)**(0.5) => (6.123233995736766e-17+1.0i) This looks like a really close approximation, but does anybody know…
Sean Huber
  • 3,945
  • 2
  • 26
  • 31
1
vote
3 answers

Iterate over a hash using keys from an array, and sum the results

I have a Hash that indexes a bunch of IDs to a value, something like: hash = {1: 3.00, 2: 4.00, 3: 2.00, 4: 15.00, 5: 12.00, 6: 1.00} I have an Array that looks like: arr = [2, 3, 6] What's a short, Ruby idiomatic way to iterate over my Array and…
randombits
  • 47,058
  • 76
  • 251
  • 433
1
vote
0 answers

Uninitialized Constant error (inside helper folder) after upgrading to Ruby 2.2.3 with RVM

I just upgraded from Ruby 1.9.3 to 2.2.3 using RVM and started getting the following output when I attempt to run rails server: /Users/nathalia/.rvm/gems/ruby-2.2.3@my_app/gems/activesupport-3.2.22/lib/active_support/inflector/methods.rb:230:in…
Nathalia
  • 41
  • 1
  • 3
1
vote
1 answer

To break up Ruby class into separate files by mixins or plain definitions?

What is the preferred way of breaking up a class into multiple files? Mixins could work, but in my case I just want to better organize a very large class. Of the two methods featured below, is one of them "better" than the other? file_A.rb require…
Winston Kotzan
  • 1,979
  • 20
  • 25
1
vote
1 answer

Rails 4.2.1 on ubuntu 15.04 execution error

I've just installed rails 4.2.1 and ruby 2.2.2. When I run rails new blog, I get the following error rbenv: rails: command not found The `rails' command exists in these Ruby versions: 2.1.6 I'm new to linux and it'll help if anyone can tell me…
1
vote
2 answers

Encrypting files for travis-ci on ruby-2.2.2 fails with "private method `load' called for Psych:Module"

I'm having trouble encrypting my database.yml for Travis CI. Based on their documentation, it appears you encrypt files with the travis encrypt-file command. I'm running on Ruby-2.2.2 and it's giving me some pretty cryptic error messages. travis…
williamcodes
  • 6,317
  • 8
  • 32
  • 55
1
vote
2 answers

Active Record Query to select an entry, that does not already have a vote that I have already given

I have the following three models Judge (Devise User) Judge.column_names => ["id", "email", "encrypted_password", "reset_password_token", "reset_password_sent_at", "remember_created_at", "sign_in_count", "current_sign_in_at", "last_sign_in_at",…
32423hjh32423
  • 3,048
  • 7
  • 44
  • 59
1
vote
3 answers

Change the structure of hash

I have a hash like below: { '3.2':{ 'abc-4536':{ "a" : "sfsdfs", "b" : "qweqda", "pa": "Printer" }, 'abc-2345':{ "a": "sdfswer", "b": "werwewe", "pa": "NewsPaper" }, 'abc-4536':{ "a" : "sfsdfs", "b" :…
Ahmad hamza
  • 1,816
  • 1
  • 23
  • 46