Sidekiq transient vs fatal errors

Is there a way to err from a Sidekiq job in a way that tells Sidekiq that "this error is fatal and unrecoverable, do not retry, send it straight to dead job queue"? Looking at Sidekiq Error Handling documentation, it seems like it interpret all erro...
more »

2017-02-13 16:02 (2) Answers

Variable interpolation in user generated content

Say for example I was building my own CMS for a restaurant and I had a page where the website owner could go in and write his own descriptions for each meal that were managed via the backend. Let's also assume that each meal has a name and price ass...
more »

2017-02-13 14:02 (1) Answers

Ruby - Configuring alternate DNS for Redis

We heavily pound Redis with our infrastructure (approx. 8K requests a sec). Especially because Redis is our job messaging system as well (we use Sidekiq). Now, many times we get the following errors: RuntimeError: Name or service not known RuntimeE...
more »

2017-02-13 10:02 (0) Answers

'undefined method `>' for nil:NilClass in ruby

This is my code for converting a user entered string into a Caesar cipher. puts "text?" text = gets.chomp puts "key?" key = gets.chomp.to_i plainTex = Array.new ciphTex = Array.new j = 0 text.each_byte do |i| plainTex[j] = i j += 1 end ...
more »

2017-02-12 22:02 (1) Answers

Ajax won't send post to rails app

I have a webpack frontend with a rails backend. They are running on different ports, and I believe this is causing me problems when I am trying to post form data to one of my rails controller end points. I have googled for a few hours and I am gettin...
more »

2017-02-12 18:02 (1) Answers

Creating a Whatsapp like model in Rails Framework.

Background: I am new to Rails and I have gone through Michael Hartl Ruby on Rails tutorial. I have read Agile Web Development with Rails 5. So for practice I was trying to design WhatsApp like framework and got stuck while creating User and Group mod...
more »

2017-02-12 11:02 (3) Answers

Downgrade/Revert Ruby Version on Heroku

I recently updated my Heroku app from Ruby 2.3.1 to 2.4.0, but I now need to revert back to version 2.3.1. To Update: I changed the version in the Gemfile from 2.3.1 to 2.4.0. Everything went fine, but I need to go back to 2.3.1 because of problems...
more »

2017-02-12 05:02 (1) Answers

Gem install not finding existing gem

When running gem install I get the following: gregoryostermayr@gregors test $ gem install jruby-boilerpipe ERROR: Could not find a valid gem 'jruby-boilerpipe' (>= 0) in any repository ERROR: Possible alternatives: boilerpipe, jruby-coercion, ...
more »

2017-02-11 17:02 (1) Answers

::Rails::Engine - No route found

I'm using ruby 2.4 and rails 5. I'm trying to write my first gem and setup an engine to mount some basic controller logic. I have the following as my engine: Foo::Bar::Mylib::Engine.routes.draw do resources :controller end My package structu...
more »

2017-02-11 14:02 (0) Answers

Making an n-dimensional matrix ruby method

First off, let me say I am new to Ruby and that I heard about NArray but I'd like to see if I can attempt to solve this (with some help from you fine folks) I learned that I could do something like this: a=Array.new(2){Array.new(2){Array.new(2,5)}}...
more »

2017-02-11 04:02 (1) Answers

How can I use JSON data with Ruby?

This seems really simple but I've looked all over and I can't find any documentation for this. I have the following json file: //data.json { "movie1": [ {"name": "Inception"} ]} and I just want to print the value of name with Ruby. json = ...
more »

2017-02-11 00:02 (1) Answers

React testing setup with rails/webpacker

I've added webpacker to my existing rails app, everything is working like a charm. Webpack config is found under config/webpack/shared.js config/webpack/development.js config/webpack/production.js node_modules are installed in vendor/node_module...
more »

2017-02-10 17:02 (1) Answers

Find declared function from user input

I have a prompt in my "app", like irb that takes an input,I want it to parse the input and execute a function that I've defined. Similarly, my app takes an input through gets, and calls the function. For example, command = gets.gsub("\n","") take...
more »

2017-02-10 16:02 (1) Answers

Adding to Ruby Objects

I have been doing a little reading up on Ruby. Like how simplistic the language is. I've been trying to look it up, and figure it out on my own. I'm looking for some help with Objects and how I add data to it. I want to make an Object called Athlete ...
more »

2017-02-10 04:02 (2) Answers

Use RSpec to test for DeserializationError

I have a job that is enqueued. Sometimes, the record associated with that job is destroyed before the job is ran. To resolve any ActiveJob::DeserializationError from being raised during the job's execution, I have added the following to the job: re...
more »

2017-02-09 23:02 (0) Answers

Rails scope on belongs_to association

Imagine a Book and a Chapter model. Each Chapter belongs_to :book, and a Book has_many :chapters. We have scopes on the Chapter, for example :very_long returns chapters with over 300 pages. Many times we want to get all books with any chapters over ...
more »

2017-02-09 23:02 (1) Answers