download github zip file and display contents in web app [closed]
How would you display the contents of a github zip file and display the contents in a web application with the correct file structure?Could I somehow insert the zip file into the database and then...
View ArticleNot able to access page data, using anemone with socksify gem and Tor
I ve written a ruby script using anemone gem to crawl a website. The script runs fine when used directly.But I would like to use socksify gem so that all TCP calls from the script is routed with...
View ArticleCanonicalizing JSON files
I have a bunch of automatically generated JSON files that I want to store in version control. The problem is that each time the files are serialized, the attributes come out in a different order,...
View ArticleHow can I update how ActiveRecord::Base#where interprets ranges?
It appears that ActiveRecord::Base#where partially distinguishes between ranges defined with 2 dots (0..) and ranges defined with 3 dots (0...).E.g.> User.where(id: ..0).to_sql=> "SELECT...
View Articleauthentication from scartch in rails
Hi i am learning rails from the Odin project and i am creating a simple authentication without using devise . the course doesn't really give enough info to help beginners finish that projectso, Here is...
View ArticleForm does not get Submitted via Mechanize
URL = 'http://public.dep.state.ma.us/SearchableSites2/Search_UST.aspx'agent = Mechanize.new()agent.get(URL)form =...
View Articleconst_defined? vs. defined? in Ruby
To test, whether a constant (say: a class) is known at a certain point in the code, I can write for instance:if defined? :Stringor I can writeif self.class.const_defined? :StringIs there a situation...
View ArticleHow to remap exceptions with Grape
In a Ruby project using Grape, I have a custom exception Api::Exceptions::InvalidValueError that subclasses Grape::Exceptions::Base. If a validation fails (which causes...
View ArticlePackage configuration not found despite sqlite3 being installed
I'm trying to install Ruby 3.2.0 and Rails 7.0.4 on an Intel Mac OS 12.6. I'm running into issues with sqlite3:package configuration for...
View ArticleHow to set view context in Rails?
I’m building a gem that intercepts Rails’ default render behavior. Instead of rendering a view, it looks for a helper method that corresponds to the current controller’s action name; it then uses the...
View ArticleRapidAPI: undefined method `get_company' for "FB":String
I am trying to pull data from IEX Trading API via RapidAPI in my Rails app. I have created a search form where the query will be used to obtain the data, however the following error message appears...
View ArticleMechanize submit result is not the correct page
I was trying to scrape booking.com as an exercise to learn Mechanize, but I can't get past an issue. I am trying to get a hotel's prices trough Mechanize using the following code:hotel_name = "Hilton...
View Articleundefined method `[]' for nil:NilClass while using Nokogiri
I am using Nokogiri to scrape data from a HTML document, but I'm running into the following error:`block in <main>': undefined method `[]' for nil:NilClass (NoMethodError)This is the code to...
View ArticleHow to fix an "undefined method" when trying to scrape a website with Nokogiri
I want to get some data from the HMs website, using this scraper:require 'nokogiri'require 'open-uri'require 'rmagick'require 'mechanize'product =...
View Articlefinding the appropriate session for an IdP single logout request with Ruby SAML
I'm putting together a gem for our Rails apps to use SAML single sign-on/logout via Entra ID. I had some questions about the final bit I need to implement: ID provider initiated single logout...
View ArticleScrape a URL for data that is loaded with Javascript using Ruby
I am trying to scrape this page for rental listings using a Ruby script. Some of the methods that I have tried unsuccessfully are using Nokogiri and Mechanize however the browser only loads 14 listings...
View Article(Ruby) Converting a string to a line of code?
So, for a game I'm working on, let's say I put a bit of text in the comment box of a spell:<secondary effects: [["Flame", 15, true], ["Poison", 0.08, true]]>By using the slice feature, I can...
View ArticleCan I write one expectation in RSpec which demands a method is called only...
I'm just finishing my first year writing production code in Rails, and I'm not really stuck here, but the non-rubyness of what I'm experiencing is weird, and I wanted to see if anyone had this...
View ArticleInstalling Jekyll on my M3 Macbook won't "stick"
I think I have painted myself into a corner trying to override the default Ruby install so that I can install Jekyll.Here is a rough timeline:I follow this tutorial to the letter and it works, my site...
View ArticleGot the right node with Nokogiri, but need to search further
I am using this.doc = Nokogiri::HTML(open(url))pic = doc.search "[text()*='hiRes']"to get this script node:<script type="text/javascript">var data = {'colorImages': { 'initial':...
View Article