Category "ruby-on-rails"

RegExp \A \z doesnt work, but thats what Rails 4 requires

I recently switched to Rails 4 and the security requirements no longer seem to allow the use of regular expressions in the style of /^..$/. The error states th

Find rows with multiple duplicate fields with Active Record, Rails & Postgres

What is the best way to find records with duplicate values across multiple columns using Postgres, and Activerecord? I found this solution here: User.find(:al

git push heroku master - no error messages but changes not displaying on web app

After installing the devise gem to create users on my web app, my changes are not appearing on the live app. I believe I am running the correct code in termina

React along with Stimulus js in Rails 6

Is there a way to use reactjs along with stimulusjs simultaneously in a an existing rails project? This is not a coding specific question rather an architectura

Heroku doesn't see my changes after git push

I am trying to deploy a new version of my app to heroku and although running it locally works, I can't see any change after I do the following: git push heroku

Revoke access to devise-jwt on Denylist strategy

I am using devise-jwt gem, from what I see on the wrapped gem https://github.com/waiting-for-dev/warden-jwt_auth there is a static method revoke_jwt(payload, us

Adding a default null value to a select tag

I currently have this line of code: =select_tag :resource_id, options_for_select( Resource.find(:all, :conditions => "resourcetype = 'data-sheets' &&

The folder currently open doesn't have a git repository

I am working on a work PC which has a windows OS and I'm used to using ubuntu OS for rails development. I installed everything properly with wsl as ubuntu on VS

Select2 with ajax gets initialized several times with Rails turbolinks events

I am a developing a Ruby On Rails app using Rails 4.2.6. I am using Turbolinks alongside jquery.turbolinks (sorry I could'nt post the links to those elements as

Rails, Capistrano - Compilation failed without serving any debug log

I'm trying to deploy my Rails5 app to AWS EC2 instance using Capistrano3. However when it comes to assets compile, it fails without logging any reasons. Where

Query method issue on rails upgrade to 6.1.5

enter image description here Upgraded rails from 6.0.3 to 6.1.5 but having issues with query methods like eager_load and references. class Note < Application

OpenSSL::SSL::SSLError: hostname "smtp.gmail.com" does not match the server certificate

This is what i have setup in setup_email.rb file, if Rails.env.production? ActionMailer::Base.smtp_settings = { :address => "smtp.gmail

Rails STI query all subclasses using base class

Imagine I have this STI table called living things with these such subclasses: class LivingThing < ActiveRecord::Base end class Animal < LivingThing end

NameError: uninitialized constant when running migration that has an inflected name

I have this migration file 20180226063342_add_bpm_to_songs.rb class AddBpmToSongs < ActiveRecord::Migration[5.1] def change .. end end and this in

Capybara and Factorybot - created data does not appear

I am facing a wired issue, factoryBot is creating a record in Db, but when capybara try to access it, there is no record in HTML. I tried debugging with "byebu

how to check if has_one exists without loading associated model

I have a simple has_one relationship class User < ApplicationRecord has_one :detail has_many :courses end class Detail < ApplicationRecord belongs_

Error when installing Ruby on Rails: "Failed to build gem native extension"

I'm running Crunchbang 11 (Debian-based). I'm trying to install Ruby on Rails, like this: gem install rails --version 4.0.0 I get the error "Failed to buil

Unable to export traces to OpenTelemetry Collector on Kubernetes

I am using the opentelemetry-ruby otlp exporter for auto instrumentation: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/exporter/otlp The otel

Difference between after_create, after_save and after_commit in rails callbacks

The difference between after_create, after_save and after_commit in Rails is that: after_save is invoked when an object is created and updated after_commit is

Undefined method `after_create_commit' for Message:Class Did you mean? after_create - Rails action cable tutorial

I've tried to follow the ActionCable tutorial - Site point and I convert this tutorial to using MongoDB . But I have the problems with devise NoMethodError in