RoR Graphql Types::BaseObject NameError
When making a graphql API request to my rails backend I get the following error in my app/graphql/types/query_type.rb:Started POST "/graphql" for 127.0.0.1 at 2023-04-06 13:27:07 +0200Processing by...
View ArticleJekyll page rating calculator with meta from Front Mater area
I am editing include/span with the following code pretend to be as "Jekyll page rating calculator with meta from Front Mater area" but it seems like some syntax missing an extra heading/lines to let...
View ArticleYARD how to document @return type for a method that returns fixed-size array?
I have the following method:def foo [true_or_false, some_integer]endit always returns an array of 2 where 1st element is boolean and 2nd is integer.How to document it in YARD using @return meta...
View ArticleIs there an opposite method of "in?" in Rails?
Is there an opposite method in? in Rails?3.in?([1,2,3])#=> trueCurrently, I'm using [1,2,3].exclude?(3) or !3.in?([1,2,3]).Is there a method like 3.out_of([1,2,3])?
View ArticleRuby Class vs Struct
I have seen codebases using Structs to wrap around attributes and behavior inside a class.What is the difference between a Ruby Class and a Struct? And when should one be used over the other.?
View ArticleHow do you change the name of the GoogleOauth2 omniauth provider name?
I am using the Google Omniauth gem here and need to provide two instances of it so I can have them ask for a different set of permissions. I have this working with an equivalent Facebook gem using this...
View ArticleCopying generated files from a Jekyll plugin to a site resource folder
I'm developing a plugin in Jekyll that inserts a new Liquid Tag (a block tag) named latex. It's purpose is to insert a block of LaTeX source code inside a post source file this way:... post file...
View ArticleHow is Hash in Ruby implemented internally? What data structure/algorithm...
I know in Java language, HashMap is the most common used to implement functions like Ruby Hash. Java HashMap is using data structure named "separate chaining with linked lists":...
View ArticleWhat's the difference between GEM_HOME and GEM_PATH?
RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed...
View ArticleHow can I implement the --trace flag in a custom Capistrano task?
I have a custom task that calls some very noisy build tasks:task :build_release do SSHKit.config.command_map.prefix[:mix].unshift("#{fetch(:asdf_wrapper_path)}") SSHKit.config.default_env[:MIX_ENV] =...
View ArticleDevise: sign in with two possible encrypted passwords
My app works with the Devise gem for authentication, but I want customize it for sign in with two possible encrypted passwords, due to my previous app worked with MD5. I've two fields in my users...
View ArticleRuby: Differences in object identity of Integers
Why is 1.equal? 1 == true but (2**100).equal? (2**100) == false?And has this to be considered as a bug?
View ArticleBest way of transforming values in array of hashes (performance)
Given: data = [ {"votable_id"=>1150, "user_ids"=>"1,2,3,4,5,6,"}, {"votable_id"=>1151, "user_ids"=>"55,66,34,23,56,7,8"}]This is the expected result. Array should have first 5 elements.data...
View ArticleDevise giving admin privileges to destroy
Just added an Admin model to Devise. I am on Rails 4.I would like to give the Admin privileges to destroy and update articles that other users have created.Having trouble finding documentation on how...
View ArticleRubyMine not showing the project folders with tree structure, it shows the...
I'm using RubyMine version 2020.3. When I open my project, the structure (file tree, folders, etc.) is not showing. I restarted and reset the file settings, but it's not working! I'm expecting to see...
View ArticleIs There A Way To Iterate Datagrid Filter Rails?
I've been learning to implement a small ROR system, and using a powerful Datagrid gem for filtering, sorting, exporting data, etc.Today, I've been trying to iterate the filters based on children...
View ArticleHow to fixing failing pytest in Jekyll project
I'm contributing to a Jekyll-based codebase and have cloned the repository and installed all the required packages. However, when I run python3 -m pytest, most of the tests fail, except for a few. I’ve...
View ArticleHow does Ruby the String interpolation of a String object?
Is my assumption correct that Ruby does not call the to_s or to_str method when interpreting a String object during string-interpolation?a = "Hallo"class String def to_s"Servus" endenddef...
View ArticleShould Gemfile.lock be included in .gitignore?
I'm sort of new to bundler and the files it generates. I have a copy of a git repo from GitHub that is being contributed to by many people so I was surprised to find that bundler created a file that...
View ArticleWrite an Rspec test to test multiple nested_attibutes
I am trying to put together a test that will test an object with its nested_attributes.I have a simple setup:class Animal < ActiveRecord::Base has_many :animal_imagesendclass AnimalImage <...
View Article