fast answer from post request in rails + heroku
I'm creating my application using ruby on rails and deploy with herokuin addition to the main page and several more, I have endpoints that are used by third-party applications to receive/record various...
View Articleimport with recursive using activerecord-import gem: has_many through...
Trying to import CSV file to the database using "activerecord-import gem".I have the following Modelsquestion.rbrequire 'csv'class Question < ApplicationRecord has_many :question_answers, dependent:...
View ArticleRuby 2.7.4 & 3.0.0 fails on macOS Big Sur (11.2.3): undeclared identifier...
Trying to install Ruby 2.7.4 & Ruby 3 on Intel Mac 11.2.3 and I'm seeing the following error during compilation (installing using ruby-install (https://github.com/postmodern/ruby-install). I'm...
View ArticleJavaScript Array: get "range" of items
Is there an equivalent for ruby's array[n..m] in JavaScript?For example:>> a = ['a','b','c','d','e','f','g']>> a[0..2]=> ['a','b','c']
View ArticleTreesitter query syntax to match the first child
I'm looking to write a treesitter query syntax https://tree-sitter.github.io/tree-sitter/using-parsers#query-syntax to match the first sibling.This is my code.if method_call [:meth_fields]elsif true...
View ArticleIs it possible/advisable to run Rails 6 without webpack(er)?
I am starting a new Rails 6 application. If I understood correctly, Webpack(er) (gem webpacker) has replaced Sprockets as the new standard for including/minifying JS (source).Furthermore, Rails 6 now...
View ArticleCannot install jekyll (eventmachine) on m1 mac
I'm a real newbie to iOS development and wanna make a new GitHub blog.I'm following How to install jekyll on Apple M1 Macbook as a reference.And I've tried installing Jekyll on my M1 Pro Macbook (macOS...
View ArticleRails Best practices : associated object creation in model
I have bassicly 3 tables : Users (email, password), Contacts (name, phone), Relations (user_id, contact_id, level) .When a user creates a new contact, i want him to be associated to it. The association...
View ArticleHow to configure silent login to Redmine upon entering to domain?
In my environment all users which registered in the domain are authenticated in the Redmine through LDAP, as described here - LDAP AuthenticationSome customers wants automatically login to Redmine,...
View ArticleHow to do SFTP transfer in batches?
Context: I have approx. 20K files to be transferred via SFTP.I am skeptical that if I send them in single session then session might terminate midway.I tried searching for timeout but what I found was...
View ArticleRake / Rspec: How to suppress / quiet / silent the first output line showing...
Problem:If I run ServerSpec (based on RSpec) through Rake with one of the following commands:rakerake specrake spec:allrake spec:<host>bundle exec rake...Rake prints the command it executes to...
View ArticleLocate index of mismatch in an array
I have an array that should contain the same value throughout and if there are mismatches, I want to pull the index of those mismatches.Example:[1,1,1,1,3,1,1,1,2,1,1,1]Output:[4, 8]What's the best way...
View ArticleHow to convert bytes in number into a string of characters? (character...
How do I easily convert a number, e.g. 0x616263, equivalently 6382179 in base 10, into a string by dividing the number up into sequential bytes? So the example above should convert into 'abc'.I've...
View ArticleRun skipped rspec tests and fail if they pass
Let's say I have a bunch of tests:spec/code_spec.rb:require "rails_helper"RSpec.describe Code do xit { Code.evaluate("Twitter.search") } xit { Code.evaluate("Slack.send") } xit {...
View ArticleHow can I sort YAML files?
I've been trying to sort an i18n translations YAML file with Ruby so I can manage new translations in a better and organized way, but I've been wondering if there is something to ease the task.I found...
View ArticlePass top-level function as callable to map
To be clear, I recognize that eval is evil, this is not for production code. That said, I'm trying to figure out if I can, for golfing purposes, shorten:$*.map{eval _1}any further, in much the same way...
View ArticleRVM install ruby 2.6.4 fails with makefile error: implicit declaration of...
RVM rvm 1.29.12-nextmacOS v11 (Big Sur) on an M1 chiprvm install 2.6.4 fails with:Error running '__rvm_make -j8',please read /Users/jason/.rvm/log/1626110300_ruby-2.6.4/make.logThere has been an error...
View ArticleError when trying to install app with mysql2 gem
Im trying to install an open source rails 3.2.21 application that uses the mysql2 gem, but when i try and run the bundle commant I get the following error:Fetching: mysql2-0.3.18.gem (100%)Building...
View ArticleHow to integrate Alpine.js into a Rails 7 application?
I have a Rails 7 application with Stimulus in it and I downloaded a TailwindCSS template that uses the AlpineJS framework. Apparently, the way I integrated Alpine.JS into the Rails app is not proper,...
View ArticleRuby Shoes packager including Shoes in the app
I can't seem to get the Ruby Shoes packager to correctly create an exe with Shoes included. I'm using the Raisins release (0.r1134), with the pack.rb replaced from github. The exe's the packager makes...
View Article