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

Rails Shrine with Uppy can't perform direct uploads

Trying to integrate uppy on my rails app. I'm using rails 7 minimal version with Shrine gem.I'm able to upload to s3 but as i try to integrate uppy it just fails.I get errors in browser console and...

View Article


How to use RuboCop Metrics/MethodLength AllowedPatterns/AllowedMethods

Running RuboCop results in the following error$ rubocopRunning RuboCop...Offenses:C: Metrics/MethodLength: Method has too many lines. [25/10] (https://rubystyle.guide#short-methods)def example_method...

View Article


Can you simultaneously test a state change and a return value in RSpec?

Say I have a method MyKlass#do_thing that I want to call exactly once in a test (because it might change a state), and that should return true on successful state change and false otherwise. I want to...

View Article

Rails: Form that sets up default values for an object?

Say I have an object that has some attributes with default values. I set up the default values for these attributes at a model level like so... after_initialize :set_defaults def set_defaults self.name...

View Article

Rails Cookies not updating on other pages

Is there a way in Rails to delete/reset a particular cookie when the value has been changed on one page?So I have 10 tabs, if the cookie is changed on tab 1 it doesn't update on the rest of the tabs...

View Article


How do I call a module method in rspec, with the current module set up

So I have the following module for handling the fetching of and saving of tweets. This is all done on a thread, I am interested in testing two methods with in this module: fetch_tweets and...

View Article

Add a gem to the bundle without adding it the Gemfile (rspec + fuubar)

I use "fuubar" as a formatter of my choice to the RSpec. In my ~/.rspec I got --format Fuubar line, which means in any RSpec run, in any project (regardless of Gemfile content) --format Fuubar is used....

View Article

How can I get commands in Rails Migration file using regex?

I'm trying to get commands from a Rails migration file as an array based on a specific migration command, using regex. My code works well on most cases, but when there is a command with multiline code,...

View Article


What is the technical purpose of using next keyword and empty method to...

I was flipping through an basic ruby textbook and I came across a piece of code that serves as an introduction to ruby blocks. letters = ("a".."c").to_aThe example iterates through the...

View Article


Is the server running on host "localhost" (::1) and accepting TCP/IP...

Before anything, please note that I have found several similar questions on Stack Overflow and articles all over the web, but none of those helped me fix my issue:PG Error could not connect to server:...

View Article

rake DB tasks hanging

After I aborted a rake db:drop db:create db:migrate command, I can no longer execute any rails or rake DB related task.I tried several things already, but nothing worked so far (reinstalling ruby,...

View Article

How do I make sure that I only load flights on search and not initial page load

Rails baby here! trying to work it out with Rails 7. I have a small toy app here that tries to search for flights then have users book a flight. I have managed to string together the app to a point of...

View Article

How do I access the Magento REST API with Ruby?

I want to start working with Magento's REST API, but I can't seem to get it working.To start with I need to get access tokens, here's what I'm trying:require 'oauth'@consumer =...

View Article


React Native M1 Mac build failure with target "React-Codegen"

When I run the command npx react-native run-ios in my terminal on my Mac I receive the errorCompileC...

View Article

How to test if a Ruby script is running via Bundler

In a Ruby script, is there a way to test if the current process has been launched via Bundler - i.e. via bundle exec or a binstub?

View Article


how to create mixlib/log custom formatter

I am using Mixlib::Log in my Ruby application as follows:require 'mixlib/log'module Log extend Mixlib::LogendLog.info 'this is an info message'This setup is working fine for basic logging, but now I...

View Article

No versions of nokogiri compatible with my Ruby

I am installing a 2017 Rails project from GitHub. It is my understanding I need to first install Ruby and Rails before cloning the project. The project uses Ruby 2.4.1 and Rails version 5.0.1, so I am...

View Article


Exception: :136:in `require'

Exception: internal:/usr/local/Cellar/ruby/3.3.4/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb:136:in require': cannot load such file -- xcodeproj (LoadError) from...

View Article

How to call "unpack" on a string in ruby C-api?

I am trying to use the ruby C-api to call unpack on a ruby string.Here is my current code:#include "ruby.h"#include <stdio.h>#include <unistd.h>VALUE dangerous_func(unsigned char* buf) {...

View Article

Web page scraping gems/tools available in Ruby [closed]

I'm trying to scrape web pages in a Ruby script that I'm working on. The purpose of the project is to show which ETFs and stock mutual funds are most compatible with the value investing philosophy.Some...

View Article
Browsing all 4604 articles
Browse latest View live


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