Category "ruby-on-rails"

Rails Remote True Ajax ActionController::UnknownFormat

I have a mini-update method in my model that only updates one field, set up in a chart (so I see the form for each row). It works properly, but want it to upda

How to pre-fill arguments to a function in Ruby?

Let's say I have a function foo: def foo(A, B, C) A + B + C end And I call it like this, with only the last parameter changing: foo("foo", "bar", "123") foo("

How to display icon with openweather api in rails app

I tried to display icon with openweather api. It work this _else.html.erb . . <div class="tenki"> <h2>Tokyo</h2> <img src="http:

Open a new terminal tab and run a command inside, only after open tab

I'm trying to create a script to open a new tab at my rails project and run rails s inside this tab, to already start my server. My command: xfce4-terminal --ta

HTTP Error 418 (Teapot Error) on Link to FlightRadar24 When Server on Localhost

I am writing a Rails web application that presents OurAirports airport data to the user. One convenience I provide is a link to the FlightRadar24 web site for t

FOREIGN KEY ON DELETE SET NULL in rails

I'm working with two models in rails class Student < ApplicationRecord belongs_to :school has_many :lessons end and class Lesson

byebug isn't displaying the output as I type

I've experienced an odd interface glitch. [44, 53] in /document.rb 44: code 45: code 46: 47: def code 48: byebug => 49:

Rails Console no scroll in windows powershell

I am curently setting up my rails enviroment on my Windows 10 pc. I am using powershell for this. I have found a bug when using a pry or the rails console. When

Why both `stylesheet_link_tag` and `stylesheet_pack_tag` are needed to install bootstrap?

I have gone through this article to install bootstrap in ruby-on-rails app. And I noticed that there are stylesheet_link_tag and stylesheet_pack_tag for css. I

Using Bootstrap Icons in Rails 6 with Webpacker

I wanted to use Bootstrap icons in beta "Official open source SVG icon library for Bootstrap." https://icons.getbootstrap.com/. This is for Bootstrap 4 in Rails

Rails 7 (7.0.2.3) Importmap jQuery is not defined in view

I've looked around for as much help as possible regarding installing jQuery in Rails 7 (7.0.2.3). I want to use it in script tags in my views, but I can't seem

CAXLXS spreadsheet cells without colors when open with excell

I´m generate an spreadsheet with colors into cells, and when I a open the file with Open office or google spreadsheet works fine, but when with Excel the

How do I make ActiveRecord search multiple tables (of similar schema) by default?

I have a very large table Metrics with a primary integer key named id. The primary key is 32 bit integer and is about to overflow. My attempted solution to this

Fail to compile webpack when I run ruby server

I have try to run my ruby server and I got this error : [Webpacker] Compiling... [Webpacker] Compilation failed: /var/lib/gems/2.7.0/gems/webpacker-5.2.1/lib/we

Rails - how to access ActionDispatch UploadedFile default attributes in my methods?

I'm new to rails and building a simple bank statement converter app. User would select bank name, upload their statement, click "convert", and the converted fil

"Undefined method `build'" when using Rspec + FactoryBotRails

I'm trying this gem called FactoryBotRails. For some reason, when I try it on one of my models unit tests, the following error is thrown. Failure/Error: my_

Mysql2::Client::LONG_PASSWORD (NameError)

I am trying to upgrade my ruby version from 2.4.5 to 2.4.9 in my rails app in Docker. After rebuilding my container it stops with the error: uninitialized co

What is the correct way to update images with has_many_attached in Rails 6

I have a Rails 6 app that uses Active Storage to store multiple images to a model (Activity) with has_many_attached. I don't understand how to append extra im

What is the correct way to update images with has_many_attached in Rails 6

I have a Rails 6 app that uses Active Storage to store multiple images to a model (Activity) with has_many_attached. I don't understand how to append extra im

Ruby / Pundit -> user.owner_of?

I saw below in the pundit documentation and was wondering if that is part of some ruby or pundit magic based on user_id being present in a given model. Or if it