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].
ruby
229,224
questions
0
votes
0
answers
18
views
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 ...
0
votes
0
answers
33
views
Extract which bytes should be included in the hash calculation (Signature)
I'm looking to implement the enveloped signature in a project and I'm creating a proof of concept.
The integration documentation requests that:
Prepare the signature document
Calculate which bytes (...
-1
votes
1
answer
47
views
How to avoid sql injection warning for rails scope [closed]
I have written scope on modal as below and called ruby class method 'display_link_query'
scope :data, -> { select("id,#{display_link_query} as display_link
.references( :...
-1
votes
1
answer
52
views
print function info without repeating or explicit calling a function in ruby
For debugging propose, in each method there is a print of the function namespace and its argument
module Test
def self.foo(arg1, arg2)
args = method(__method__).parameters.to_h { |p| [p.last, ...
1
vote
1
answer
79
views
App not starting with cryptic Passenger log error
I have a Rails app set up with Passenger + Nginx.
When trying to access the app I get the following error in passenger's logs:
/home/my_user/.rbenv/versions/3.3.1/bin/ruby: No such file or directory --...
0
votes
0
answers
82
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') %>
<...
3
votes
2
answers
72
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 &...
-1
votes
0
answers
40
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 ...
0
votes
0
answers
42
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 ...
0
votes
0
answers
43
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 (...
0
votes
1
answer
47
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 ...
1
vote
1
answer
55
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
...
0
votes
0
answers
76
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....
0
votes
0
answers
20
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 ...
1
vote
1
answer
57
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: ...