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,197
questions
0
votes
2
answers
1k
views
How to find all classes that includes a module
I have a module called Nameable and some models that include this module.
Is there a way to know which models (classes) have included this module?
0
votes
1
answer
77
views
How to rename column in rails through terminal?
I am unable to rename column through terminal
how to rename column in rails without writing anything inside migration file .I meant to say how we can rename column through terminal only.so please give ...
0
votes
2
answers
4k
views
Scraping iframe data using Nokogiri and Ruby [closed]
This is my script written to scrape data inside the <iframe> tag using Nokogiri:
require 'nokogiri'
require 'restclient'
doc = Nokogiri::HTML(RestClient.get("http://www.sample_site.com/"))
...
0
votes
1
answer
67
views
Download images returned in hash from scrapifier?
I'm trying to scrape images in a website, and download them to a local folder.
I'm using scrapifier gem which looks simple.
I've installed it, made a scrape.rb and ran it from the terminal ruby ...
12
votes
3
answers
2k
views
Rails Action Text for existing text field
I am upgrading one of my news app to Rails 6.0.0. While working around I got a problem using Rich Text. My app is pointing the rich text body field instead of the my existing table body field.
Is it ...
3
votes
3
answers
2k
views
Error when performing pod install command
I installed Flutter with following the documentation at their website but when I want to run it and perform pod install I get this error. I tried changing version of Cocoapods but it doesn't work. ...
-1
votes
0
answers
27
views
Why is the data in a Rails view displaying as 0.0 or 42.0 instead of $42.00?
Question Title: Why is the data in a Rails view displaying as 0.0 or 42.0 instead of $42.00?
Summary: How can I get this field to display e.g. $42.00 instead of 0.0 or 42.0? In addition to the ...
-2
votes
1
answer
1k
views
Rails link_to and merge parameter into existing parameters
I have a link_to directive that adds a link to an icon by passing a block to link_to. What I'm trying to do is merge existing query parameters in the URL and append this one as well if it is clicked. ...
22
votes
5
answers
610
views
Detect new method visibility in class method
Here's a code example:
class Foo
def self.create_method
def example_method
"foo"
end
end
private
create_method
end
Foo.public_instance_methods(false) # => [:example_method]...
3
votes
8
answers
8k
views
Stimulus Controllers Not Functioning At All In Rails 7 App
I'm really struggling to get Stimulus controllers to function in a Rails 7 app I'm working on and would appreciate any help anyone might have. I've been spinning my wheels forever.
My Application.js
//...
0
votes
0
answers
15
views
Issue with Psych::DisallowedClass Exception when using reify in PaperTrail with Sinatra
I am working on a Ruby project using Sinatra version 3.0.6 and Ruby version 3.0.0. I am using the PaperTrail gem (version 15.1.0) to track changes in my models for auditing and version control ...
1
vote
1
answer
46
views
Ruby module is not an ancestor after prepend
I'm developing a plugin to the Rails (6.1.7) project Foreman (v3.5.1; based on the Foreman Plugin Template) and face the issue that one of my modules (DnsInterfaceExtensions) ought to be prepended to ...
0
votes
0
answers
37
views
Ruby case examples, consistently only shows one action under when [closed]
I've waded through multitudes of Ruby case questions, here and on the web. They all have one thing in common, they only show one statement following the when. Of the form,
case whatever, simple, ...
0
votes
0
answers
26
views
Issue with 'libgmp-10.dll' in Ruby while compaling script with Ocra
I'm having an issue while trying to create an executable with ocra in Ruby and I'm not able to fix it no matter what, even chatGPT couldn't help.
The issue is with libgmp-10.dll. The compiler works ...
1
vote
5
answers
156
views
In Ruby, how do I find a value in an array of hashes?
I am trying to get a value in an array of hashes in Ruby. Given the following information below:
# array_of_hash_objects will look something like this:
# [
# { name: 'Ruby', is_my_favorite?: ...