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

ruby `pry`: can I edit classes defined on the REPL?

Context: exploratory experimenting written directly in the REPL.In pry, if I type edit fn_name I can open the definition of fn_name in an editor and change it. Say:def fn_name puts 'fn_name'endI can...

View Article


Stop rails console from printing out the object at the end of a loop

If I, say, loop through all the instances of a given model and output something from each, at the end, irb will still print the entire object. If the object ends up taking hundreds of lines, it'll be a...

View Article


Error when installing ruby 2.7.1 on macOS: Error running '__rvm_make -j8'

I need install ruby 2.7.1 in my macOS 14.2, i've already tried rvm and rbenv and reinstall openssl, i need help pls!Sorry for the bad english$ rvm install 2.7.1...

View Article

Ruby: Is there a way to get the enclosing Module const of a Class?

I'm doing some metaprogramming in Ruby, and I need to dynamically generate a sibling class inside of a module. In doing so, I want to call const_set on the module, but I don't know which Module...

View Article

VScode Sorbet enable only the LSP, instead of the typecheck

We have a large Ruby on Rails started at ROR version 4 (recently upgraded to ROR 7, with Ruby 3.2.1).-> Now the issue is till date we were using the JetBrains RubyMine with docker-compose setup,...

View Article


Cannot uninstall cocoapods from macOS ruby installation

I'm trying to uninstall cocoapods from my system installation of ruby and I get the following error:sudo gem uninstall cocoapodsIgnoring ffi-1.15.5 because its extensions are not built. Try: gem...

View Article

rspec - How to test ActiveRecord::RecordNotFound?

I have a method to update people's attribute, and it will rescue ActiveRecord::RecordNotFound if the people cannot be found. The method is: def update @people= People.find(params[:id]) if...

View Article

How to use docker compose for aws ecr

Until now I had only the rails server and database but now I have added a few dependencies like sidekiq, redis and sneakers for rabbitmq. I want to use docker-compose. I have below dockerfile and...

View Article


error: call to undeclared function 'mysql_ssl_set'; ISO C99 and later do not...

I'm trying to gem install mysql2~/s/r/railties> gem install mysql2Fetching mysql2-0.5.6.gemBuilding native extensions. This could take a while...ERROR: Error installing mysql2: ERROR: Failed to...

View Article


Finding the current academic year

I want determine if a date is within the current academic year. In order to do that, I've written a function to determine the current academic year. Is there a better way to do this?# returns start and...

View Article

How to use ENV Variables inside Ruby file in nested Object [closed]

Given the following File Content:gitlab_rails['omniauth_providers'] = [ { name: "oauth2_generic", label: "Example", app_id: "ENV_VARIABLE_HER", app_secret: "ENV_VARIABLE_HERE", args: { client_options:...

View Article

Add `Authorization Bearer` hash to Net::HTTP post request (Ruby)

How can I add Authorization Bearer to a POST request with Net::HTTP?I can only find help for "basic authentication" in the documentation.req.basic_auth 'user', 'pass'Source:...

View Article

Renaming controllers in Rails and cleaning out generated content

I was following along with the railscast regarding the restful_authentication plugin.He recommended running the command:script/generate authenticated user sessionWhich I did, and everything generated...

View Article


How do I create an average from a Ruby array?

How would get find an average from an array?If I have the array:[0,4,8,2,5,0,2,6]Averaging would give me 3.375.

View Article

How to package ruby on rails app into an executable

I created an app using ruby on rails and would like to share it with someone. How can I create an executable so they can simply download and run the app?I searched many answers online but they seem to...

View Article


Homebrew install: Failed during: git fetch origin...

I ran the following command on terminal (Mac El Capitan) $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"and got the following error message:Failed...

View Article

Why does my docker image keeps getting rebuilt form scratch? (kamal, docker...

When I do kamal deploy my image keeps being re-created from scratch (e.g. it's compiling ruby each time).Here is my Dockerfile:FROM debian:bullseye-slim as baseENV BUNDLER_VERSION="2.5.5" \...

View Article


How to fix a bundler error when upgrading Ruby from version 2.7.5 to version...

I was updating the Ruby version on my rails application. I updated from version 2.7.5 to version 3.0.6. I fixed all the broken dependencies and my project is successfully launched using the rails s...

View Article

Where do I put the -p flag when running a "rails generate" in "pretend" mode?

The Rails help message says:General options: -h, [--help] # Print generator's options and usage -p, [--pretend] # Run but do not make any changes -f, [--force] # Overwrite files that already exist -s,...

View Article

aws-sdk-core/xml/parser.rb:74:in `set_default_engine': Unable to find a...

I am having a legacy ruby daemon script that runs on a linux server. On upgrading all ruby and gem package versions with in the instance, the daemon script is now erroring out. Same error I am getting...

View Article
Browsing all 4609 articles
Browse latest View live


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