Skip to main content

Questions tagged [ruby]

Ruby is a multi-platform open-source, dynamic object-oriented interpreted language. The [ruby] tag is for questions related to the Ruby language, including its syntax and its libraries. Ruby on Rails questions should be tagged with [ruby-on-rails].

Filter by
Sorted by
Tagged with
0 votes
1 answer
27 views

What is best way to set time in a Rails app form so that the time is the same once I enter it and doesn't change?

I have a Rails 7 form where I enter in data to populate a database. I have a start_time and end_time in the form: <%= f.time_select :start_time, :value => Time.now.strftime('%I:%M %p') %> <...
mwhocl's user avatar
  • 77
1 vote
1 answer
26 views

Rails: How does form_with know, which Controller-action to invoke?

Taken this form as an example: <%= form_with model: @product do |f| %> <!-- ... --!> <% end %> The routes-file: get "/products", to: "products#index" get &...
cluster1's user avatar
  • 5,388
0 votes
0 answers
24 views

How to handle session managment in ruby on rails app with mixed structure monolithic and api using devise and devise jwt

I have a Ruby on Rails 7 app with devise to handle Registration and session managment for 3 models, Admin, Company and Users. Company has_many users, Admin and Company works in the monolithic ...
Giordano Díaz's user avatar
0 votes
0 answers
25 views

How to download Sidekiq Pro (private gem) in pipeline

Sidekiq Pro is a private Ruby gem that requires authorization and, although I've gotten it to work locally, I've been unable to get it to work in the pipeline. I use a yaml file on my repo to define ...
tofersApology's user avatar
0 votes
0 answers
27 views

Heroku : ruby app, issue when i tried to push it

i create an app on ruby on rails with heroku this app already exist online now I try to push a new version of this one on heroku, but i have an issue. i already update my ruby and rails version (...
Fabien Goussen's user avatar
0 votes
1 answer
43 views

Model method not recognizing parameters

I'm building a rails app where users can search through "Playlists", which is an object containing a title, image, and tracks. I've defined a search method in the Playlist model that takes ...
Jillian Hoenig's user avatar
1 vote
1 answer
38 views

Saving an associated polymorphic object duplicates it

I have two models, one of them being polymorphic and second one being a "parent" one: class Person has_one :asset, as: :assetable accepts_nested_attributes_for :asset end class Asset ...
mbajur's user avatar
  • 4,468
0 votes
0 answers
64 views

For Ruby extension, how should I save a reference in C or Rust side?

I'm working on a client-side caching library that caches objects in a HashMap. A simple example is below: fn insert(key: RString, obj: AnyObject) -> AnyObject { let rust_struct = self....
Yang's user avatar
  • 389
0 votes
0 answers
16 views

Can't activate jar-dependencies-0.3.10, already activated jar-dependencies-0.4.1

I'm getting this error. can't activate jar-dependencies-0.3.10, already activated jar-dependencies-0.4.1 Please help me My project has gem 'jar-dependencies', '0.4.1' but in my system it was ...
ankit susne's user avatar
1 vote
1 answer
51 views

Ternary operator not working inside Lambda function Ruby

I am trying to write a Lambda function in Ruby, to calculate the nth Fibonacci number. fib = -> (n) { n in [1, 2] ? 1 : fib.[n - 1] + fib.[n - 2] } This gives me the error, ./fib.rb:3: warning: ...
Shirsak's user avatar
  • 57
0 votes
1 answer
41 views

Rails: Extended class that calls another extended class

Setup: We got an initializer (in config/initializers) that requires a file where we define our extensions. This file does something like this: module UbiquoExtensions end :SomeClass.include!(...
raquelhortab's user avatar
0 votes
1 answer
36 views

bundle install cannot load such file

When I try bundle install or RCT_NEW_ARCH_ENABLED=1 bundle exec pod install in my project I get this error. Mac on chip M2 /opt/homebrew/opt/ruby/bin/bundle:25:in `load': cannot load such file -- /opt/...
IncognitoUser's user avatar
2 votes
1 answer
57 views

Ruby setter-methods: Is the equal-character (=) a convention or functionality?

Taken this class as a example: class House def initialize(color, size) @color = color @size = size end def color @color end # Is the = part of the syntax or a convention? def ...
cluster1's user avatar
  • 5,388
0 votes
0 answers
24 views

Trying to install Nanoc (with Ruby) on Fedora Linux, but getting an error I can't decipher

I try to install Nanoc on Fedora Linux. I've successfully installed Ruby using dnf install ruby Checked it with ruby -v and made sure rubygems is installed. Also checked version to verify ...
zektiv's user avatar
  • 1
0 votes
0 answers
16 views

Issue with rails hotwire trix textarea resize

im trying to create a textarea resize grippie more or less like the SO for a trix textarea with rais stimulus so i set this controller below the issue is when i pull down the textarea the textarea ...
jjplack's user avatar
  • 113
0 votes
0 answers
30 views

Ruby with Postgresql raising NumericValueOutOfRange

I'm trying to do the following query using ruby and pqsql, but when trying a range with more than 1.000 registers I'm receiving an error. . . . user.left_outer_joins(:coverage_radius).where(id: i)....
Leonardo Furtado's user avatar
0 votes
2 answers
70 views

Model VS Active record in ROR

Can somebody please explain me the difference between model and active record in simple words ? Is active model and model same ? PS: Knowledge regarding these topics will be appreciated. I am newbie ...
Anuja Sharma's user avatar
0 votes
1 answer
32 views

Why can't I wrap Sidekiq.configure_server in Rails after_initialize?

After upgrade to Rails 6 the initializers/sidekiq.rb is causing deprecation warnings about class autoloading. As a workaround I thought I could wrap the contents of Sidekiq.configure_server in Rails....
jva's user avatar
  • 2,817
5 votes
5 answers
127 views

Capturing all matches of a string value from an array of regex patterns, while prioritizing closest matches

Let's say I have an array of names, along with a regex union of them: match_array = [/Dan/i, /Danny/i, /Daniel/i] match_values = Regexp.union(match_array) I'm using a regex union because the actual ...
lumos's user avatar
  • 213
0 votes
0 answers
43 views

Rails: problem with "@hotwired/turbo-rails" and redirects

// app/javascript/application.js import "@hotwired/turbo-rails" import "controllers" import "trix" import "@rails/actiontext" import Rails from "@rails/ujs&...
Steven's user avatar
  • 13
0 votes
0 answers
26 views

Ruby debugging will not work in VSCode for any of the debuggers

I am trying to debug a ruby program and cant get the debugger to work for ANY of the debuggers. I have tried rdbg, pry-byebug, byebug and LSP. Every time I try to run the bebugger it says DEBUGGER : ...
Sean's user avatar
  • 1
0 votes
1 answer
39 views

Both controller level and Model level metadata simultaneously in the same column of record. how to store in PaperTrail: versions table

I'm encountering an issue with PaperTrail in my Rails application where I'm trying to store both controller-level and model-level metadata in the versions table, but only the controller-level metadata ...
Mohan Mali's user avatar
0 votes
0 answers
24 views

unknow keyword: :expires_in when deploy Ruby 3.2.2 application to AWS Elastic Beanstalk

When I try to deploy Ruby 3.2.2 application to AWS Elastic Beanstalk (Platform Ruby 3.2 running on 64bit Amazon Linux 2023), I get below error: [29074] unknown keyword: :expires_in [29074] /var/app/...
lei lei's user avatar
  • 1,821
0 votes
0 answers
24 views

Storybook Configuration with Ruby on Rails [closed]

I'm trying to follow the view_component-storybook configuration. I've replicated everything on my windows machine and the static preview pages also work. But the storybook playground doesn't render ...
Vipul Shinde's user avatar
0 votes
1 answer
48 views

How do I remember where user left in rails

In rails how do I remember which page user left at with user login. When same user comes back he lands on the same page. I am new to rails not sure how I can approach this problem. Is there any gem to ...
Manav's user avatar
  • 649
1 vote
0 answers
27 views

Why Tailwind CSS doesn't works with public/*.html files in my Ruby on Rails project

I'm using Tailwind CSS for my Ruby on Rails project, the CSS works fine with all the layouts in views but it doesn't works with public/*.html files in my project. I have a 404.html page and a 500.html ...
Ansari Junaid's user avatar
0 votes
0 answers
43 views

Rails: problem with handle redirect with turbo_stream in apps

In the application, when creating a feature, it was necessary to add hotwired/turbo-rails. // app/javascript/application.js import "@hotwired/turbo-rails" import "controllers" ...
Steven's user avatar
  • 13
0 votes
1 answer
53 views

Your Ruby version is 2.6.10, but your Gemfile specified 3.3.0

I've gone through all of the fixes for this. I do not/nor have I ever had ruby 2.6.10 installed on this machine. I'm not sure where this came from. I tried regressing to ruby 3.2.0 for something but ...
Int'l Man Of Coding Mystery's user avatar
0 votes
0 answers
58 views

Error while installing ruby on rails on windows 11

I'm trying to install Ruby on Rails, but when I run the command "gem install rails", PowerShell throws this error: C:\Users\milos>gem install rails Using rubygems directory: C:/Users/...
Milda's user avatar
  • 1
0 votes
0 answers
74 views
+100

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(...
Some nerd who does not have a 's user avatar
0 votes
0 answers
24 views

Why would an active record value be inconsistent with the value it refers to in a Ruby spec file? [closed]

To simplify the problem, here's the general flow of the code let(:teacher) { create(:teacher)} context 'some context' let(:subject) { create(:subject, name: 'Math', teacher: teacher)} When I ...
msapere's user avatar
  • 181
0 votes
0 answers
55 views

How to implement service object pattern in RoR? [closed]

I'm a Java developer and recently learned Ruby. And I have a concern about the ServiceObject pattern in RoR. I read an article here (https://medium.com/selleo/essential-rubyonrails-patterns-part-1-...
tuhalang's user avatar
  • 101
0 votes
0 answers
26 views

Ruby on Rails, threading in DelayedJob workers

I'm working on a Ruby on Rails web project that runs on Puma server, also has several DelayedJob Workers on different servers. The project generates some special logs that i want to send to AWS Sqs ...
Ricardo Vila's user avatar
  • 1,636
0 votes
2 answers
134 views

Rails Heroku deployment fails: Could not find gems, Failed to install gems via Bundler

So I have a Rails application that I am trying to push to Heroku. When I run git push heroku master, I get: $ git push heroku master Enumerating objects: 1369, done. Counting objects: 100% (1369/1369),...
Slaknation's user avatar
  • 1,886
0 votes
0 answers
22 views

JBuilder and Rails 6.1

I am working on a POC for switching from active-model-serializer to jbuilder. I am very sad to see AMS being relegated to unsupported status. It's going to take forever to convert our 200+ serializers ...
Dan's user avatar
  • 1,278
0 votes
0 answers
23 views

Error installing msgpack (1.4.4) on ruby 3.0.4 on M1 mac

While installing msgpack gem I'am receiving this error: /Users/orbanbotond/.frum/versions/3.0.4/lib/ruby/gems/3.0.0/gems/msgpack-1.4.4/ext/msgpack make DESTDIR\= compiling buffer.c compiling ...
Boti's user avatar
  • 3,345
0 votes
0 answers
115 views

'Error running pod install' while running Flutter app on iOS simulator after setting up Firebase in VSCode

After I setup my Flutter application with Firebase and connecting the app with the Firebase console, I am not able to run the application in the iOS simulator. My system description is - 2017 Macbook ...
Nikhil Gohil's user avatar
0 votes
0 answers
53 views

Ruby REPL's errors and REPL freezing

I'm new to Ruby and am currently working on a scraper on vsc (Windows OS). I downloaded the nokogiri, watir, and pry gems, and I've been opening a pry REPL to run a few basic commands that test my ...
ppak's user avatar
  • 1
0 votes
1 answer
64 views

Rails/Ruby join using calculated field

I'm trying to work out if/how I can use a field from a joined table in a calculation inside a where statement. Plot.joins(:developer) .where('plots.reservation_release_date < ?',developer....
user1587804's user avatar
0 votes
1 answer
53 views

Ruby's Net::SSH is limited to 3 authentication tries while OpenSSH client is not

I'm having a really weird problem where when I connect to an SSH server (that has a pretty standard default configuration, including a default MaxAuthTries of 6) using Net::SSH, the connection fails ...
Guss's user avatar
  • 31.8k
0 votes
0 answers
20 views

LCNAF plugin archivesspace

I have to integrate LCNAF plugin in a website. For the purpose I a configured the appconfig file and included the 'lcnaf' term. Additionally, in the plugins folder I have included the lcnaf files that ...
Karan Vishwakarma's user avatar
0 votes
0 answers
30 views

puts method not working on cucumber test report

I want to print the text I copied from the web page on to the cucumber html test report step but I can only see it in the console does anyone know how to resolve this? Then ('on step 5 should show ...
user3341382's user avatar
2 votes
3 answers
98 views

Remove invalid bytes, keep valid UTF-8 (in Ruby 2)

(I posted a similar problem here, but this new question is not a duplicate). Using either Ruby 2.6.10 or 1.9.3 is a requirement that the software I'm developing here must run with these: Small ...
user1934428's user avatar
  • 21.6k
1 vote
0 answers
55 views

Linkedin Oauth In Ruby on Rails is Not Logging In Every Few Times

I have been developing an app that is using new Linkedin OpenID login feature. The thing is that it works, but it works most of the time. Every few times, (3-10, quite random) it doesn't log you in ...
Tatsurou's user avatar
  • 131
0 votes
0 answers
22 views

How do display discarded messages when searching through elasticsearch?

I am using gem elasticsearch-rails to perform search for messages.However, it does not display the discarded message's record. I have tried using unscoped too, but that does not work either. Ex: ...
Hieutm1908's user avatar
0 votes
1 answer
54 views

Rails Turbo Frames: "Content missing" after Update-action (View doesn't update)

I like to use Turbo Frames in my existing Rails-App. index.view looks now this way: <h1>Projects List</h1> <div><strong><%= pluralize(@projects.size, "Project") %> ...
cluster1's user avatar
  • 5,388
0 votes
0 answers
18 views

solr erro : Solr::Error::Http - 503 Service Unavailable

We are using sunspot solr in our rails application. Large data we reindexed using sidekiq worker in background. Sometimes we got below issue while reindex data RSolr::Error::Http - 503 Service ...
Uday Magdum's user avatar
1 vote
1 answer
97 views

Ruby (Windows) - Bundle install or update failing - fail to install openssl

Due to a new Heroku update (which keep the Gemfile.lock even if it's windows), I am trying to do a new bundle install (or bundle update, both are failing), because otherwise I can't push my code onto ...
bseido's user avatar
  • 11
0 votes
1 answer
61 views

Ruby on rails - Error Uninitialized constant twilio when initializing its instance

I am getting error while creating client instance in twilio. Below is the code and error uninitialized constant LogInController::Twilio Extracted source (around line #26): ...
Anuja Sharma's user avatar
0 votes
0 answers
42 views

How to submit form by Ferrum::Browser without using javascript

I want to submit a form by Ferrum::Browser. <form action="/login" method="post" name="login_form"> <button type="submit" name="login">...
ironsand's user avatar
  • 14.9k

1
2 3 4 5
4584