Rails render: appending instead of replacing content
I am following this tutorial https://guides.rubyonrails.org/getting_started.html#creating-a-new-article, it shows how to add validation messages. But when I submit the form it is appending a new page...
View ArticleStripe error while creating customer: You passed an empty string for 'card'
Stripe will not accept payments, the charge keeps failing. I am getting this error:Started POST "/charges" for 127.0.0.1 at 2014-06-09 06:30:58 -0700Processing by ChargesController#create as HTML...
View ArticleImplementing the Luhn validation algorithm in Ruby
I've been trying to implement the Luhn algorithm in Ruby. I've been following these steps:The formula verifies a number against its included check digit, which is usually appended to a partial account...
View Articlesystematically changing filenames in a directory w/ Ruby
I'd like to grab all the files in a particular directory, and then apply a gsub(/abc/,'z') to all the filenames and essentially resave the files under the new filenames, how do I do that?I've been...
View ArticleOnline Betting Games and Security: How to?
I've developed a betting game (using bitcoins). This is how it is set up:Using javascript, clojurescript, ruby on sinatra.Initial Way (Plan A)Client side: JavaScript is evaluated. This includes all...
View ArticleRSpec test fails with inconsistent request_id when testing missing...
I'm writing an RSpec test for a validator in my Rails application that should raise an Error::External::SessionNotFound error when the api_process is not found. However, the test intermittently fails...
View ArticleHow to use a Puppet File Resource to give different permissions on a...
I would like to use Puppet to manage a directory. I want the directory to be owned by user root and group admin, with 0770 permissions.I would like all files in the directory to be owned by user apache...
View ArticleHow to solve Bundler::PermissionError There was an error while trying to...
While running bundle install on windows I get the following error unless I run from an elevated prompt.Bundler::PermissionError There was an error while trying to write to < path > It is likely...
View ArticleVSCode Ruby RuboCop formatter removes focused specs `fit` -> `it`
I've been happily using https://github.com/rubyide/vscode-ruby in VSCode which has been auto-formatting my code on save, until this was merged https://github.com/rubocop-hq/rubocop-rspec/pull/1109...
View ArticleMaking a simple Battleship game in Ruby
A while back I did the Codecademy - Python track and made a simple battleship game. I've been learning Ruby now and wanted to try to convert the game from Python to Ruby. So far I've been doing well in...
View ArticleHandle ActiveRecord::RecordNotUnique in Devise registrations controller
My users table has unique indexes on the email and username fields. Every now and then the uniqueness constraint will be broken, and a ActiveRecord::RecordNotUnique exception will be thrown. It can...
View Articlehow do I get name of the month in ruby on Rails?
so i create in my view: <%=date=Date.today%>How do i get the name of the month out of the date? I was trying to do sth like <%= DATE::ABBR_MONTHNAMES(date.month)%> But without success. I...
View Articlesolidus_starter_frontend --- admin/login fails
ExecJS::ProgramError in Spree::Admin::UserSessions#newShowing C:/Users/welcome/.gem/ruby/3.3.0/gems/solidus_backend-4.3.5/app/views/spree/admin/shared/_head.html.erb where line #11 raised:TypeError:...
View Articlepath issue because none of my ruby programs work [closed]
I figured it was path issue because none of my ruby programs work this is what the error reads below:/Users/.../.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not...
View ArticleHow to "require" a third party module in C code when trying to call ruby...
I have the following code here:#include <ruby.h>int main(int argc, char* argv[]){ /* construct the VM */ ruby_init(); /* Ruby goes here */ int state; VALUE result; result =...
View ArticleHow to do a newline in output
How do I make \n actually work in my output? At the moment it just writes it all in 1 long block. Thanks for any helpDir.chdir 'C:/Users/name/Music'music = Dir['C:/Users/name/Music/*.{mp3, MP3}']puts...
View Articleruby - new error - "object allocation during garbage collection phase"
I upgrade an already running ruby application to 3.3.5 and it seems a new bug has arrived.It is a "C" extension and I'm now confused about the GC in ruby. Let's start…I using a rb_protect in C to...
View ArticleRuby Date Calculation
This is not a problem so much as something I noticed and was wondering if someone could explain it to me.If I use inline-type syntax I get two different, interchanging, answers:d = (Date.today >>...
View ArticleReferenceError: Rails is not defined when importing @rails/ujs in Rails 7
I'm new on using Ruby on Rails and I'm a bit confused on how to import @rails/ujs. This is my app/javascript/application.js code:import Rails from "@rails/ujs";import Turbolinks from...
View ArticleDocusign e-signature API disabling reassigning not working
I am using the Docusign ruby SDK for e-signature API and want to disable reassigning to another email when creating Docusign envelope. To do this, I have specifically set allowReassign as false in the...
View Article