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

nil} error in view spec">No route matches {:controller=>"..", :view=>nil} error in view spec

I am trying to write view spec I have for a partial. It is located on the path app/views/lecturers/science/_table.html.erb and the spec is laid out like so on...

View Article


Migration from MySQL to SQL Server in Ruby on Rails [closed]

We are planning to migrate our database from MySQL to SQL Server in a Ruby on Rails application. Is this feasible? What potential issues should we be aware of during this migration process?Need to know...

View Article


Ruby regex, match contents of certain HTML tag [duplicate]

Consider the following HTML snippet:[arbitrary content]<script type="text/javascript"> window.__PRELOADED_STATE__ = {"locale": "fr-FR","env": "production" };</script><script...

View Article

LoadError: cannot load such file -- async-websocket Rails 6.0.2.2

I'm setting rails application on ubuntu GCP VMAfter bundle install I see this errorCaused by:LoadError: cannot load such file -- async-websocket/home/user1/project1/config/application.rb:7:in <top...

View Article

bundle install use already installed local gems in containers

I am using containers (podman). Whenever we bundle during the image build, bundler fetches and installs the gems every time. How can I get bundler to use local gems already installed on the system?I...

View Article


Regex pattern to match contents of specific HTML tag [duplicate]

Consider the following HTML snippet:[arbitrary content]<script type="text/javascript"> window.__PRELOADED_STATE__ = {"locale": "fr-FR","env": "production" };</script><script...

View Article

How to compress arrays of integers into an array of ranges and integers in Ruby

I have a sorted array of integers, and want all subsets of consecutive integers to be replaced with a range, so that:[1,2,3,4,5,6,7,8,9,10,42]is replaced with:[1..10,42]It's a list of rows from a...

View Article

Ruby bundler cannot reach rubygems.org

I wanted to create a new rails app. Then, I ran bundle install but it always gave me the following error:Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from...

View Article


Prepend output while streaming like foreman

I have this ruby script that I use quite often:$stdin.each_line do |it| it.strip! eval(ARGV.first)endFor instance:> dir | each "Dir.chdir(it) { puts it; system('bundle') }"codeBundle complete! 41...

View Article


Handling large zip files with RubyZip: Limitations with 65535 files

I'm currently facing an issue with the RubyZip library while processing large zip files containing hundreds of thousands of files. It seems that RubyZip has a limitation of 65535 files per zip...

View Article

Customize devise controller and views

I am naive in ROR. I am trying to login user with only email, using devise. I want to render login page if user with email provided does not exist. But, when I try to render 'new', after checking that...

View Article

How can Sinatra be configured to run within a virtual sub-directory of a...

I have an app in Sinatra that accepts requests at the root and with a name using:get '/''Root page'endget '/:name' #Some code hereendWhen hosting the application behind a reverse-proxy using a...

View Article

How to pass raw binary data to the put() method of rack/test?

I'm doing this:require 'rack/test'data = # some binary data, for example, ZIP archiveput('/foo', data, 'content_type' => 'application/octet-stream')Works just fine, until I put the % symbol into the...

View Article


Treesitter query syntax to match the first child

I'm looking to write a treesitter query syntax https://tree-sitter.github.io/tree-sitter/using-parsers#query-syntax to match the first sibling.This is my code.if method_call [:meth_fields]elsif true...

View Article

How to get a refresh token when using the Google Calendar API Ruby Library?

I'm a newbie trying to implement the Google Calendar API into a web-based app and after following the instructions that they provide to the t, fetching information only works for about 20 minutes...

View Article


Exporting an Environment Variable in Ruby

How do I export an environment variable from within a Ruby script to the parent shell? For example, implementing a naïve implementation of the read Bash builtin:#!/usr/bin/rubyvarname =...

View Article

Do something after succesful login in Rails devise

I have a Rails app and use devise for registration and sign-up of users. Now I want to store the date of the last successful login on the user.Basically I thought about overwriting the create method in...

View Article


How can I capture mariadb "Duplicate entry" exceptions in Ruby?

I'm using the mysql2 gem to access MariaDB from Ruby to INSERT thousands of records. These sometimes cause "Duplicate entry" errors, due to violating a UNIQUE key I've assigned, specifically for the...

View Article

How can I resolve pod install issue and successfully run pod install?

I'm experiencing the same issue while trying to recompile and build a project for a customer after a clean macOS Sonoma install and installing Xcode 15.4. When I run pod install, I encounter the...

View Article

Issue with running "pod install" when setting up the SDK for iOS simulation...

As a first-time user trying to set up the SDK for testing and running the official sample demo on iOS simulation in Xcode, I encountered an issue with the "pod install" command. It seems that the...

View Article
Browsing all 4604 articles
Browse latest View live


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