Could not locate Gemfile

I'm certainly no Ruby developer but I have an application on my server using Ruby, Gems, and Bundler. I am trying to install another Ruby on under a different user account but on the same VPS....

How to change the position of an array element?

I have a question on how I can change the index of a array element, so that it doesn't come at the 7. position but at position 2 instead... Is there a function to handle this?

Changing entry in an array while looping through it

arr = ["red","green","blue","yellow"] arr.each do |colour| if colour == "red" colour = "green" end end puts arr.inspect The above code outputs: ["red", "green", "blue",...

Rails validation method comparing two fields?

My model has two fields that i want to compare to each other as part of the validation. I want to be sure end_time is after start_time. I have written a validation method to compare them, but I...

Append query string to url

I have a callback url string params[:callback] and I need to append a query string "&result=true" and redirect the user. The better way I found of doing this is using addressable but I think the...

Iterating through Rails relationships recursively to find specific parent class

I have Discussions (polymorphic) that belong to Projects, Tasks and Subtasks. Tasks belong to Projects, and Subtasks to Tasks. I have users connected to Projects via join table called 'synapses'....

How to round an average to 2 decimal places in PostgreSQL?

I am using PostgreSQL via the Ruby gem 'sequel'. I'm trying to round to two decimal places. Here's my code: SELECT ROUND(AVG(some_column),2) FROM table I get the following error: PG::Error:...

Why a module's singleton method is not visible in downstream eigenclasses where it gets mixed?

I understand the regular method lookup path i.e. class, superclass/module, all the way up to BasicObject. I thought it was true for singleton version of the chain also but doesn't seem the case...

Quick Sort in Ruby language

I am trying to implement Quick sort in ruby but stuck in how to call recursively after the first partition of pivot. Please help me to understand on how to proceed and also let me know whether my...

Rails Streaming not Streaming

I am working to add a streaming component to my rails app as I'd like to start using SSEs. I have tried getting this to work in a smaller example but am still having trouble. I have been having...

Syntax error in for loop (Ruby/RSpec)

While running the RSPEC test as shown below im getting this error: Using Accessor#strict_set for specs SyntaxError:...

Mavericks, RBENV, Your Ruby version is 2.0.0, but your Gemfile specified 2.1.1

I've read and tried the suggestions in several, other, questions, like mine (all with accepted answers) as well as a few more hours of Google searching, but nothing worked. That leads me to think...

Assigning model field value with dynamic field in Rails

Suppose I have a variable param that represents a field name in an ActiveRecord model. I want to set the field to a specific value. I know there are 2 ways of doing it (might be more), but my...

Ruby check if datetime is a iso8601 and saving

I need to check if a DateTime is in a valid ISO8601 format. Like: #iso8601? I checked if ruby has a specific method but I haven't found any. Currently I'm using date.iso8601 == date to check...

Deep Convert OpenStruct to JSON

I have an OpenStruct that is nested with many other OpenStructs. What's the best way to deeply convert them all to JSON? Ideally: x = OpenStruct.new x.y = OpenStruct.new x.y.z = OpenStruct.new z =...

How to update Ruby with Homebrew?

I want to know how to update to the latest stable version of Ruby with Homebrew. I am not interested in using RVM. Thanks.

How to skip Chrome Welcome screen, every time I run Appium, Ruby test

I'm new to Appium. So my requirement is to run web driver test through Appium in simulator but when I run every time chrome always shows the welcome screen which I have to manually skip to see the...

Using Ruby in an Elixir umbrella appp

I am running an Elixir umbrella app on Heroku. All is fine but one thing. I am using :erlport, github: "hdima/erlport" to run some Ruby code (asciidoctor-latex). This works locally but not on...

Nginx error: client intended to send too large body

Periodically I get an error: This site can't be reached. The webpage at https://example.com/document might be temporarily down or it my have moved permanently to are new web address. My site is...

Get unique array of month and years between two dates

I have two Date objects, for example: first = Fri, 02 Dec 2016 last = Wed, 01 Mar 2017 What is the most efficient way to get a unique array of months and years between them? In this case I'm...

I want to run wpscan on Ubuntu vps server, but getting ruby errors

Firstly i installed wpscan on ubuntu by following these methods apt-get install git sudo apt-get install libcurl4-openssl-dev libxml2 libxml2-dev libxslt1-dev ruby-dev build-essential libgmp-dev...

How to check if variable is an Integer or Float

I want to check if my variable is either an integer or float. This is for a calculator. I don't want it to be looping indefinitely. How would I do so? I tried to do the following: puts "Enter a...

Error occurred while installing mini_racer (0.2.0)

I am using mac 10.14. I have some problem with mini_racer gem. After run bundle install the below error occurs. I don't know how can I solve this. Error Installing mini_racer 0.2.0 with native...

How to deep transform values on Ruby hash

I have a hash which looks like this: hash = { 'key1' => ['value'], 'key2' => { 'sub1' => ['string'], 'sub2' => ['string'], }, 'shippingInfo' => { 'shippingType'...

Why authenticate_with_http_token doesn't work?

I have a Users controller that looks like this: class Api::V1::UsersController < ApiController include ActionController::HttpAuthentication::Token::ControllerMethods before_action :find_user,...

Commonmarker gem cannot be installed (needed for jekyll) macos

what do I have to do, is there a problem with dependencies? How do I fix those? I am on catalina. I repeatedly get this error and have already looked for the directory.. doesn't exist. sudo bundle...

Trying to connect to an API for IGDB

I've been trying to connect to an API for a Project in school. I'm currently using Ruby. I'm trying to connect to the API for IGDB and display video games and I just cannot. I've been getting...

Occurrence of Sequel::DatabaseDisconnectError at puma worker, even though the db is disconnected in puma's before_fork-hook

I have a hanami 1.3 app, but the issue should be unrelated to hanami. I want to connect to a second db with plain Sequel-gem. Therefore I define the connection in hanami's config/environment.rb: #...

Ruby on rails warning "ruby is loading libcrypto in an unsafe way"

When i run rails commands on the terminal like creating a model, this is the error I get: WARNING: /Users/my_mac_username/.rvm/rubies/ruby-2.5.3/bin/ruby is loading libcrypto in an unsafe way [1]...

PG::UndefinedFunction: ERROR: function array_append(anyarray, anyelement) does not exist

In my application we have few test cases which are configured with GitHub workflow,Even I do have only space related changes on file but still getting below error. Not sure why my specs are still...