bundle exec jekyll serve: cannot load such file
I am trying to contribute to a Github Page/Jekyll site and want to be able to visualise changes locally but when I run bundle exec jekyll serve but I get this output:bundler: failed to load command:...
View ArticleAdding an entry and having rollbacks
After creating an entry, i'm having this to my logs.Started POST "/village_condos" for ::1 at 2024-03-25 08:05:22 +0800Processing by VillageCondosController#create as HTMLParameters: {"utf8"=>"✓",...
View ArticleDecrypt ruby DES-EDE3-CBC encrypted data in Python
I have a bunch of data which are encrypted in Ruby by following codetext = '12345678'key = '6b4f0a29d4bba86add88be9d'cipher = OpenSSL::Cipher.new('DES-EDE3-CBC').encryptcipher.key = keys =...
View ArticleRails generate migration not working
I've got below command run on consolerails g migration payslips first_name:string last_name:stringBut this just generates empty file like belowclass Payslips < ActiveRecord::Migration def change...
View ArticleRails flash.notice briefly appearing after reloads
I have a controller action in Rails as follows: def register if logged_in? current_user().courses << Course.find(params[:course_id]) flash.notice = 'Successfully registered!' redirect_to '/' else...
View ArticleHow to connect to HTTP Rest API that authenticates with LDAP
I am writing a Ruby script to connect to a REST API website.The website is authenticated by using LDAP / SSO using the AD credentials, so no basic authentication or user/password has to be...
View ArticleValidate UUID string in ruby/rails
I am working on an API. For a better developer experience, I would like to report back to the user any easily-found issue with params. My code validates strings, integers, booleans, iso8601 dates, and...
View Article'configure: error: cannot compute sizeof (long long)' on scientific linux...
I'm trying to update my version of ruby, running on Scientific Linux, but the command:$ rvm install ruby-2.1.6fails with this error:checking size of long long... configure: error: in...
View ArticleCompared with non class/module error
I'm trying to limit the number of albums a user can create by only showing a link to a new album if the number of albums is greater than 3. The error I am getting says 'compared with non...
View ArticleWhy is hot reloading not working in Vite + Rails?
I created a rails app, and installed vite_rails gem. My javascript is in app/frontend folder.However, hot reloading when I save a JS file is not working.I also tried by installing...
View ArticlePass block passed to method to another method in Ruby
I'm trying to write a clone of the ruby keep_if and delete_if array methods. Here is my code.module Strain def keep self.inject([]) do |extracts, element| yield(element) ? extracts << element :...
View ArticlePutting if statement in Ruby create
Example.create( attribute1 = "asdf", attribute2 = "asdf2", attribute3 = "and 20 more attributes")But how do I conveniently make variable2 = "qwer" if random_thing == "zxcv", without having to have two...
View ArticleRuby - finding the first N palindromic prime using lazy evaluation
i think my code is correct - yet i do not return an array in time for N = 200. Error is "Terminated due to timeout"what can i do to improve the performance of this code?def is_palindrome? (n)...
View ArticleHow to create rakefile for ra10ke
I need assistance in creating a Rakefile to implement Ra10ke. Ra10ke is a tool that performs checks on the Puppetfile to ensure correctness, including syntax, deprecated modules, dependencies, etc.I...
View ArticleIs it possible to configure CSP differently for specific routes in...
Is it possible to get different CSP policies in a Ruby-on-Rails app, depending on the routes used ? I would like config.csp = SecureHeaders::OPT_OUT for specific routes, but precise CSP on other routes.
View ArticleHow do you access data from a VCR cassette for testing?
I'm using the VCR gem and I've figured out how to record an API request to a cassette in JSON format. Now how do I access the information in the body of the response from that cassette?
View ArticleHow can I properly delete a cache key on a Ruby on Rails project using...
My ROR project is currently utilizing memcached (3 nodes) on AWS elasticached to circumvent reading from the database. When trying to delete the key, it seems like Rails or Memcached is often only...
View ArticleHow to generate a 16-digit robust not guessable coupon code?
I am looking for a robust ruby code to create 16 digit not guessable coupon codes.I.e. AH9A-TE9A-443G-TGRWThere is a promising pseudocode at this answer written by Neil Slater# Random, unguessable...
View Articleform_with is trying to generate the action with the wrong path
I'm experimenting with routing and namespaces.When implementing a form with <%= form_with model: [@user, @address] do |form| %>i receive this error undefined method...
View ArticleCount number of days between two dates
How do I count the number of days between these two dates?start_date = Date.parse "2012-03-02 14:46:21 +0100"end_date = Date.parse "2012-04-02 14:46:21 +0200"
View Article