New answers tagged ruby
1 vote
How to use existing chromium profile for ferrum?
I had to disable incognito mode and pass only user data directory path like this: OPTS = { incognito: false, browser_options: { 'user-data-dir' => '/tmp/chromium' } } Ferrum::Browser.new(...
Tooling
0 votes
0 replies
0 views
Automating repetitive tasks with Ruby and Selenium WebDriver
Updated. I think now it is clear what I want to do.
Tooling
0 votes
0 replies
0 views
Automating repetitive tasks with Ruby and Selenium WebDriver
You need to spend more time thinking about what you want and present a better explanation to us. Right now we're having to guess on a lot of things. Window? What kind of window? Are you talking about ...
0 votes
Emulate Default Object#inspect Output?
how about this class Aaa def initialize ; @name='aaa' ; end def inspect ; 'foo' end end a = Aaa.new #=> foo just one line: Object.instance_method(:inspect).bind_call a #=> "#<Aaa:...
Tooling
0 votes
0 replies
0 views
Automating repetitive tasks with Ruby and Selenium WebDriver
What kind of info? Previous question provides more accurate info How to post multiple serial numbers from file to a website EDIT: I updated my question
Tooling
2 votes
0 replies
0 views
Automating repetitive tasks with Ruby and Selenium WebDriver
You need to provide WAY more info if you want a reasonable answer.
0 votes
difference between calling super and calling super()
When we call super without parentheses, it automatically passes all arguments from the child method to the parent method. When we call super(), it invokes the parent method without passing any ...
Advice
0 votes
0 replies
0 views
Remove un-numbered lines from vscode
Found solution do not know if only one or correct one. Had tried searching setting for line and space and changing setting with no result. Watched video where there searched for height (not same ...
2 votes
Accepted
Convert a string to only have regular alphabet characters, from any language
Don’t try to define a Unicode “cutoff.” Instead, sanitize and rebuild the boolean query before sending it to MySQL. In Rails: Normalize Unicode (so weird presentation characters don’t break parsing). ...
0 votes
How to mass create with smarter_csv for an API - Ruby on Rails
Mass importing data into your DB table is very easy with SmarterCSV: def upload seller_id = @current_user.sellers.first.id options = { chunk_size: 1000 } SmarterCSV.process(params[:file]....
0 votes
RSpec Cannot find my Controllers Uninitialized Constant
another response from the future just add the following to your controller RSpec.configure { |c| c.before { expect(controller).not_to be_nil } }
5 votes
Accepted
Regex Named Capture Group also Include Complete String
Just wrap the whole thing (apart from the anchoring at the beginning and end) into an additional (?<foo>(...): ^(?<foo>(?<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) (?<s_ip>\d{1,...
Advice
1 vote
0 replies
0 views
New DataTypes For Ruby
I suggest creating a gem first. What kind of data types are you thinking about, would you mind elaborating?
Advice
0 votes
0 replies
0 views
Remove un-numbered lines from vscode
Same file 40 lines Notepad++ and 6 in Vs Code both snapshots same physical size. Am working in a Laptop so very little screen space to start with. The comment was made "I don't like that VSCode ...
Advice
0 votes
0 replies
0 views
Advice
0 votes
0 replies
0 views
Remove un-numbered lines from vscode
Haha, the questions was up for 13 hours, yet within 3 minutes you and me both decided to post a comment asking fro a screenshot.
Advice
2 votes
0 replies
0 views
Remove un-numbered lines from vscode
This might be one of those rare cases where a screenshot would help.
4 votes
Rails 8.0.4 app build from scratch test ("bin/rails test") gives wrong number of arguments in line_filtering.rb
Ruby on Rails 8.0 is not compatible with Minitest 6.0 (see this bug report). You have to either downgrade Minitest to 5.1 or do update Ruby on Rails to 8.1. Both can be done be setting the desired ...
Advice
0 votes
0 replies
0 views
Why are things magically available in the current scope in a ruby script in Jekyll?
Yes that was more or less my question. But I realize that I didn't understand correctly that there was no "module isolation" in ruby (if that terminology makes sense)
Advice
1 vote
0 replies
0 views
Remove un-numbered lines from vscode
All lines are numbered if you choose to number them. If you see not actual lines without numbers, it can be the space used by VSCode to show some code statistics, number of references, and the like. ...
0 votes
ROR action-text. How to add text-align options to trix rich-text editor?
Text align in Trix is trix-y (🙄) Digging into this I found a solution that works well. This article by Konnor Rogers lays out the basics, but I still had trouble in the edit-after-save. In the end, ...
0 votes
Rails: Why do I get "warning: already initialized constant JSON::VERSION" when running rake cucumber?
For Mr. EdgeCase, If none of the above solutions worked for you, try what worked for me by visiting the actual file those warnings are referencing. Once inside the file, find the lines referenced ...
1 vote
Accepted
Ruby on Rails Redis connection_pool wrong number of arguments (given 1, expected 0)
If you don't want to downgrade your connection_pool gem (and sidekiq) you can do this instead, just use the pool: false: config.cache_store = :redis_cache_store, { url: ENV['REDIS_URL'], pool: false }
3 votes
Accepted
Negative Unix timestamp in Ruby
Is there any way to know when a negative unix timestamp will be too old to reliably represent? There is non reliable way. It depends on how the particular platform chooses to represent the timestamp, ...
Advice
0 votes
0 replies
0 views
Why are things magically available in the current scope in a ruby script in Jekyll?
Could you clarify the question? Are you asking how Jekyll is available without calling require "xxx" where xxx is wherever the Jekyll is defined and where its declarding Jekyll.logger ?
Advice
0 votes
0 replies
0 views
Why are things magically available in the current scope in a ruby script in Jekyll?
require simply runs the file. That's literally all it does. People have a tendency to make it sound a lot more complicated than it needs to be. If you want isolation, you need Refinements.
0 votes
How to split a string in half, into two variables, in one statement?
how about this: class String def split_at(i) return [self[0...i], self[i..-1]] end def split_by(r) return [self] unless m = r.match(self) return [ m.pre_match, m[0], m.post_match ] ...
Advice
0 votes
0 replies
0 views
Why are things magically available in the current scope in a ruby script in Jekyll?
Indeed, I think I didn't understand that there was no scope isolation between ruby files. I thought require was mandatory in each file to bring things into scope
Advice
1 vote
0 replies
0 views
Why are things magically available in the current scope in a ruby script in Jekyll?
I admit I am too lazy to look up how Jekyll does it (it's open source, so you can do that yourself if you want), but building something that does the same thing is not rocket science: #!/usr/bin/env ...
Advice
1 vote
0 replies
0 views
Why are things magically available in the current scope in a ruby script in Jekyll?
It sets the value during initialization? I’m not 100% sure I understand the confusion—think of it as “not needing globals. or window., and code runs during initialization. Same thing happens in JS ...
0 votes
VScode, WSL, Ruby, Files Being Marked as Changed on Commit
I've faced this problem before. The common issue is due to the OS Terminal detecting the file permissions or the file line endings as file content changes These are the common solutions (copied from ...
0 votes
Ruby aws-sdk - timeout error
Made the following changes to our AWS initializer for the aws-sdk-s3 gem: Aws.config.update( # Other configurations like `region` and `credentials`. http_idle_timeout: 60, # Seconds a persistent ...
0 votes
Ruby SSL_connect certificate verify failed: unable to get certificate CRL on macOS
There's OpenSSL 3.6.1 now, and building Ruby with that version worked for me.
Top 50 recent answers are included
Related Tags
ruby × 229231ruby-on-rails × 112233
ruby-on-rails-3 × 16124
ruby-on-rails-4 × 12304
rubygems × 11124
activerecord × 8545
rspec × 8061
arrays × 7679
regex × 5397
javascript × 4743
hash × 4300
sinatra × 4221
devise × 3878
heroku × 3806
postgresql × 3536
json × 3353
nokogiri × 3268
ruby-on-rails-5 × 3172
mysql × 3060
string × 2967
rvm × 2760
html × 2741
watir × 2684
selenium-webdriver × 2535
jquery × 2345