Category "ruby-on-rails"

$(document).ready does not work in Rails

I'm using a *.js.erb in my Rails-App, which reacts to a clicked Link. But when I render my page, by getting there via a link_to, I have to refresh the Page, to

Rails public folder items not available in production

I have a few items that are accessible just fine in development mode within the /public directory of my app: favicon.ico, robots.txt. I can view these in devel

Ruby -- trying to grab <title>this here</title> even if on multiple lines

Currently, I am grabbing titles using the following method: title = html_response[/<title[^>]*>(.*?)<\/title>/,1] This does a great job at catch

full width responsive image with image tag in Rails 4 app

Im using the code below to make header images appear randomly in a app I´m making. I want the images to span the whole width of the screen but somehow it

Rails recursive association with migrations

I have a table named Nodes. Each node belongs to one father of the same table, and has one child on the same table too. This is the Node model: class Node <

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