Category "ruby"

Associate Active Record tables through non-primary, non-unique column in Rails

I have a table "films" whose schema looks like this: create_table "films", force: :cascade do |t| t.integer "tmdb_id", null: false t.string "language_is

Associate Active Record tables through non-primary, non-unique column in Rails

I have a table "films" whose schema looks like this: create_table "films", force: :cascade do |t| t.integer "tmdb_id", null: false t.string "language_is

BUILD FAILED (Ubuntu 20.04 using ruby-build 20210119)

I'm using rbenv and in Ec2 instance I'm trying to install a ruby different version but when I execute rbenv install 2.7.2 following errors occur. Downloading

Allowing ruby buildpack on Heroku to use Yarn cache

I'm running a Ruby on Rails + Webpacker app on Heroku with Yarn v2 and hitting some issue with dependency caching. It seems that Yarn dependencies are reinstall

How to disable Pry autocomplete?

I would like to disable autocomplete in Pry. How to do it? I'm using it in Rails console(from Emacs/inf-ruby) and it is very slow and annoying in my legacy app.

Active storage problem - replacing pictures

I'm using:ruby 2.6rails 6.1.4devisedevise_token_authactive-storage usingl locally disk service I'm creating api in which I can storage and upload pictures. I ca

POST api request in two models in Ruby on rails

I would like users to be able to create a booking, and give it a partner (BookingPartner) in the same request, similar to this "booking": { "address": "

Upgrade Ruby 2.6 to 2.7 - WebMock no longer recognizes RegEx patterns on stub requests

I am upgrading a Rails 6.1.4 application from Ruby 2.6.10 to Ruby 2.7.6. With Ruby 2.7.6, WebMock no longer matches the Regular Expressions that worked perfect

Hide default value in form Ruby

I have a form and when I set a value, the value is displayed in the field, how to not display the value but keep the existing values when submitting the form: H

Using operators, how to set a variable equal to one of two other variables depending on which one has a value, in Ruby? [closed]

When there are only two states for instance variable "a", either it has a value or not, and there is only one possible state for instance vari

Given an `RDF::Term` from the `RDF::Vocab` library, how do I infer the XSD datatype(s) I should expect?

I'm using Ruby scripts to to round-trip a SKOS vocabulary definition in Turtle format through to a spreadsheet (via CSV) and back to allow non-technical people

(Rails 5) LoadError: cannot load such file -- sass ...when deploying to Heroku

I'm getting the error in the title when I deploy my Rails 5 app. I recently updated my Gemfile to include some more recent versions. I don't have any issues on

Slideshow images load on page reload Rails & OwlSlideshow

I'm facing the following problem: I'm using an external API that returns a image hash that has multiple images. When I enter the show page for the element that

How to create live changing text in ruby?

How to live changing in ruby, I receive API but it looks like: the number is 1 the number is 2 the number is 3 it's normal because inside the loop and when I u

PG::UndefinedTable: ERROR: relation "entries" does not exist

I'm trying to deploy a simple Rails app in heroku but I'm getting this message in the heroku logs: PG::UndefinedTable: ERROR: relation "entries" does not exist

RSpec: how to chain receive().with()?

I've been writing tests with instance_doubles to stand in for message chains when I need more granularity in the midst of the chain. But, I'm wondering if I'm d

I got a "spawn ruby ENOENT" error and don't know where to begin

I'm trying to learn the programming language Ruby and I am following a freeCodeCamp.org tutorial. I've installed Atom and installed Atom Runner (I believe that'

No such directory ruby.exec Errno:ENONT

I'm new to ruby on rails. I installed ruby, sqlite3, node and yarn, run gem install rails and gem install sqlite3. when I run rails new <app_name>, I got

creating a class object array inside another object?

I've got these three classes class Totalizavel def retorna (qnt, valor) total = qnt * valor return total end end class Venda < Tota

Ruby 2.7 and TLS 1.3 with RestClient not working

I'm having problems trying to request an endpoint that is using TLS 1.3 require 'base64' require 'openssl' require 'rest-client' auth_payload = { grant_type: