What is the easiest way to remove the first character from a string?
Example:[12,23,987,43What is the fastest, most efficient way to remove the "[",using maybe a chop() but for the first character?
View ArticleHow to read gzip file download from an API
I`m trying to download a file from an API that give me sales of a client. But I dont know how to do it.url = URI("https://conciliation.stone.com.br/v1/merchant/{MYCODE}/conciliation-file/20240909")http...
View ArticleRuby and Microsoft Entra ID
We have a Ruby web apllication which is registrated in Azure Microsoft Entra ID.We registered the application but it doen't work.AADSTS650053: The application 'Application' asked for...
View ArticleHow to define a class instance variable in Ruby Struct subclass?
How can I define a variable that has shared access by instance methods of a Struct?I can use a global variable $tmp like this:Triple = Struct.new :x, :y, :z do def mul s $tmp.x = x * s $tmp.y = y * s...
View ArticleDisabling GraphQL introspection requests on production
For company policies reasons I must disable the introspection feature of graphql-ruby gem (making the __schema requests fail / return 404).How do I achieve this?The application is based on Ruby on...
View ArticleHave a ruby script output what version of ruby is running it
How do I have my ruby script output what version of ruby is running it?
View ArticleHow to revert/undo local changes to an Activerecord object?
Is there a way to undo/revert any local changes to an Activerecord object. For example:user = User.firstuser.name # "Fred"user.name = "Sam"user.name_was # "Fred"user.revertuser.name # "Fred"I know I...
View ArticleBuilding a hash in a conditional way
I am using Ruby on Rails 3.0.10 and I would like to build an hash key\value pairs in a conditional way. That is, I would like to add a key and its related value if a condition is matched:hash = { :key1...
View ArticleShopify: Error coming from `bundle install`
I am getting error.I am trying the Shopify Remix app. The error occurs when I add the extension in my app and run Shopify app dev.Any idea how to resolve this?Here is error in the textShutting down dev...
View ArticleRuby hash pattern matching - optional pattern
With Ruby 3 hash pattern matching, is it possible to specify that the rest contains only allowed keys?So far I only came up with this:opts = { value: 5, limit: 10 } # valid# opts = { value: 5 } #...
View ArticleAdd custom fields to object in ROR application
I'm working on CRM platform.I would like my users to add, edit and delete custom fields in Client, Contact and Lead objects. Those fields may be plain textfield, list, checkbox, tag etc. Those fields...
View ArticleWarning: the lockfile is being updated to Bundler 2, after which you will be...
I put some new gems in my Gemfile and ran bundle install.The installation went successfully, but at the end I got this warning:Warning: the lockfile is being updated to Bundler 2, after which you will...
View Article'development' database is not configured
I am getting this error while doing rake db:migrate of newly cloned app.'development' database is not configured. Available: ["production"]So after reading the error, I am doing RAILS_ENV=production...
View ArticleCan't Render Emojis Using MiniMagick in Ruby on Rails
Could you please help me with generating images that include emojis?Currently, I'm failing to load the font and getting the following error:MiniMagick::Error in HomeController#index`mogrify -gravity...
View ArticlePuppet error Unknown variable: 'ssh_user' for custom resource type in a...
I am seeing the following error when my Puppet agent is attempting to retrieve the configuration from the Puppet Server (v8), all running on Redhat OS:Error: Could not retrieve catalog from remote...
View Articleunable to install cocoapods on macbook and latest revision of Ruby
I tried all ways and check all topics related to updating to latest revision of ruby on Mac, and not of them works.I started by Pod.init command on terminal, the output was the...
View ArticlePuppet module for uninstall a software
I need to remove seafile and seafile gpg on my debian machines,I think modify the puppet module for install seafile.class remove_ seafile { case $facts['os']['distro']['codename'] {...
View ArticleHow to determine if one array contains all elements of another array
Given:a1 = [5, 1, 6, 14, 2, 8]I would like to determine if it contains all elements of:a2 = [2, 6, 15]In this case the result is false.Are there any built-in Ruby/Rails methods to identify such array...
View ArticleAdd .class files path to JRuby run command line
I have 2 file in folder: ~/hello.rb and ~/help.rb. hello.rb requires help.rb.I have compiled them into ~/build/ folder with:jrubyc -t build/ .When i run hello.rb with jruby, jruby searches for...
View ArticleTrouble with pod install of hermes engine on m1 mac
I've created a React-Native application as of 0.70.6, went through the grief of cocoapods and everything that comes with development on Apple's silicon chips (M2) and got it working and have done quite...
View Article