Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Browsing all 4604 articles
Browse latest View live
↧

Positive Lookahead and Non-capturing group difference when using gsub

When you want to match either of two patterns but not capture it, you would use a noncapturing group ?::/(?:https?|ftp)://(.+)/But what if I want to capture '_1' in the string 'john_1'. It could be '2'...

View Article


in `lambda': tried to create Proc object without a block (ArgumentError)

scope :for_user, (lambda {|user_id| a = Follow.follows(user_id); Question.where{user_id.in(a.select{followed_id})}})Gives me: `lambda': tried to create Proc object without a block (ArgumentError)I've...

View Article


RackInitializationException: exit error when deploying JRuby (9.4.8.0) WAR in...

I am encountering an issue when deploying a JRuby (9.4.8.0) WAR file in Tomcat (9.0.58.0). During initialization, the deployment fails with a RackInitializationException and an exit call in the...

View Article

Parsing JSON without any conversions in Ruby

I am writing a Ruby script to migrate JSON files from one format to another. In this, I need to preserve the exact contents and formatting of all the values. Is there a JSON library in Ruby that will...

View Article

rspec rails testing: how can I force ActiveJob job's to run inline for...

I would like my background jobs to run inline for certain marked tests. I can do it by wrapping the test with perform_enqueued do but I'd like to just be able to tag them with metadata and it happens...

View Article


How to create an IO object for Aws::S3::Object to stream d/l line by line?

Ruby novice here. I'd like to stream a large S3 object (text file) and process it line at a time. I don't want to store the object data locally or load it fully in memory. Aws::S3::Object#get() takes a...

View Article

How to install the Ruby LSP extension in a devcontainer without root user

I'm developing a ruby app in a devcontainer in VScode. In the container I am a non-root user. Now I want to install the Ruby LSP extension in the devcontainer, but I get following errors:Failed to...

View Article

says if i develop a Ruby on Rails application using Rails 2.3.2, will that...

says if i develop a Ruby on Rails application using Rails 2.3.2, will that usually be compatible with Passenger on my hosting company?If i ssh to my hosting company and type rails -v, i get 2.2.2... so...

View Article


fastlane - Cannot load file by `require` command

I'm trying to use a remote Fastfile using the import_from_git command. But in order to not have a mess, created a helper in another file. My problem is that fastlane correctly clones the main file, but...

View Article


How do I import ruby classes into the main file?

I'm trying to learn how to program with Ruby and I want to create separate files for separate classes, but when I do I get the following message:NameError: uninitialized constant Bookconst_missing at...

View Article

Running an application's commands, like rake, from a standalone ruby script...

I am on Ubuntu 18.04.I have a Rack-based application at /home/jignesh/webapps/my-app-1 (henceforth this will be referred to as app_root).app_root contains following...

View Article

Sinatra clears session on post

enable :sessionsset :session_secret, 'secret'post '/login' do session[:loggedInUser] = jsondata['username'].to_s puts session[:loggedInUser] +" is the session"endEverything is good at this point. When...

View Article

What does this ruby operator mean $? [duplicate]

What does the $? Ruby operator mean?I know that it is used for system calls and can be used to tell if a system call was successful. I tried searching for documentation but couldn't find it.

View Article


incremental array in ruby, 0..40, [10, 20, 30, 40]

How can I offset this array so it only outputs every ten numbers?(0...40)[10,20,30,40]

View Article

Can't make a new line in slim template

My code is the below.mails_preview.rbsummaries = ["test\ntest\ntest\ntest", "test\ntest\ntest\ntest"]ClientsMailer.test(summaries)clients_mailer.rbclass ClientsMailer < ApplicationMailer def...

View Article


ActiveStorage CSV file force encoding?

I have a CSV file that I'm uploading which runs into an issue when importing rows into the database:Encoding::UndefinedConversionError ("\xCC" from ASCII-8BIT to UTF-8)What would be the most efficient...

View Article

Can't connect to MySQL server (110). Ruby on Rails aws codebuild deployment....

I am trying to push some of my code to live. I am using aws codebuild and bitbucket pipeline to deploy. When I try to push my change through, the pipeline loops for 40 mins and eventually fails once...

View Article


Trying to install Ruby 3.2.2 but keep getting error during installation

Please bear with me as this is my first time coding with Ruby, but I've been trying to install it for a while now but each time I keep getting the following error. Does anyone have any advice on how to...

View Article

How to create a product image on Magento Api using Ruby

I am try to upload a image on magento API using Ruby.This is my code:require 'rubygems'require 'soap/wsdlDriver'require 'base64'WSDL_URL = 'http://teeshop.chandru/api/v2_soap/?wsdl=1'soap =...

View Article

Why `arr.push(hash)` replacing old values [closed]

Facing a weird problen in ruby. Please refer following snippet.@items_list = []params[:items].each do |item| status, item_data, _status_code = get_item_details(item[:item_code]) @items_list <<...

View Article
Browsing all 4604 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>