When comparing DateTimes, all objects being compared must be the same type. However, I have a data set that has nil dates. I want to treat these dates ...
When comparing DateTimes, all objects being compared must be the same type. However, I have a data set that has nil dates. I want to treat these dates ...
My goal is to move an account to another OU. My understanding is that the following code should do the job. However, it returns false. There is no err ...
Given an array arr and an object v, I want a copy of arr without the elements equal to v. I found these two solutions: and Is there an easier w ...
I am new to Ruby. I have the below code in my controller. Desired Behaviour:- I want to display the validation error string on my views on edit page. ...
I have a file called "output.txt": I want to read the file and print the name and age values on one line, one after the other: The code I wrote ...
I'm upgrading an app from Ruby 1.9.3 to 2.0.0 and I've come across the following: vs. I have not been able to find an explanation in the docs or ...
In my Rails application, I'm trying to generate a PDF file using PDF-Kit. I'm trying to add a footer to the PDF. I'm getting an error whenever I try t ...
Recent versions of Ruby support the use of braces in globbing, if you use the File::FNM_EXTGLOB option From the 2.2.0 documentation However, the 1 ...
Given that I have an array of hashes abc and a hash ghi: what is the cleanest and most efficient way of selecting hashes from abc that contain all ...
In the following code, p and puts give the same output. Why is this the case? p should have called book1.inspect instead of book1.to_s. ...
This was the behaviour in 1.9 ruby: This is the behaviour in 2.0 ruby: I am wondering about this change in behaviour for to_s method in 2.0. Ed ...
I'm trying to get the sidekiq service started, however when I run I get the following Oddly enough, I have sidekiq running on another Ubuntu bo ...
Trying to get the aerospike ruby client to work under 1.8 What is the equivalent of these calls in ruby 1.8 ? https://github.com/aerospike/aerospike ...
I created a bash script file: I am creating a black list file in "/etc/modprobe.d". Creating or deleting any file from "/etc" requires sudo access. ...
The following expression evaluated to true on Ruby 1.9: but I have no clue how this is happening. Am I missing something here? ...
I have an array and I want to convert it to a hash. I want the array elements to be keys, and all values to be the same. Here is my code: One alte ...
I have a following array I need to sort this array in a way that I get following: I tried to use the sort method arr.sort and arr.sort_by{|wor ...
I have many files in the folder, such as mp4, mov, avi files. But I have to find files that are end with "_college.mp4". I tried following way But ...
I have scenario as, I have stored a hash value in the abc file. Here is my abc file now I have to retrieve that hash. So that I can read the file ...
I have a folder, consider its location is /home/itsme/videos. Folder contains many files (files with extension .txt, .rb, .mp4 etc). But from that f ...