Category "ruby-on-rails"

How to use Sweet Alert to send ajax DELETE request in Rails?

Problem 1: When I click the link, the sweet alert modal pops up for a split second, disappears, and redirects to route. Not sure why the modal is only flashing

Nginx two server blocks listen on 80 and 81 not working

Inside /etc/nginx/sites-available I have these two three files: default server { listen 80 default_server; listen [::]:80 ipv6only=on default_server;

Making a Rails join table with custom names

I'm trying to create a join table (InfrastructureReferral) between the two Agent and Infrastructure models, but using custom names. This is my source code: Envi

rails s LoadError: cannot load such file -- refile/simple_form

I am having an issue with when I run rails s. I am working on a legacy application and attempting to upgrade to the latest versions of rails and ruby. Current a

How can I highlight multiple fields but show a single error message when ActiveRecord validation fails?

My use case is that at least one out of two fields needs to be filled in. I'd like to be able to show a single error message but use Rails' built-in error highl

Rails nokogiri XML create

In ruby on rails i use Nokogiri to create XML files. Now I want to create a XML line like this: <mis:actions param="-900" accuracy="1" cameraIndex="0" payloa

What is `null false` in mutations graphQL rails?

module Mutations class BaseMutation < GraphQL::Schema::Mutation null false # <---- what is this? end end In a lot of classes, I see this function

bin/rails console doesn't start

I'm new to Rails & Ruby in general. I was following this guide and got stuck on step 6.3. my bin/rails console result in error below /home/gaura/.local/shar

ERROR: While executing gem ... (Gem::Exception) OpenSSL is not available

I get this openssl error when trying to install/update any gem, although I have openSSL installed through brew install openssl. This can be frustrating but ther

Rails validation error message not showing

I am trying to add a custom error message for my model validation. Seen below: validates :cost, numericality: { greater_than_or_equal_to: 0, message: :custom_er

How can I control daisyUI tailwind modal open as default

I set daisyUI but not figure out how to control modal by condition I think similar with flowbite or bootstrap https://flowbite.com/docs/components/modal/ but da

Database management tasks definition for multiple db in a remote connection context

This section of the rails guides states: If you would like to connect to an external database without any database management tasks such as schema management, m

Database management tasks definition for multiple db in a remote connection context

This section of the rails guides states: If you would like to connect to an external database without any database management tasks such as schema management, m

Can we upload files to AWS S3 and Google Cloud Storage simultaneously using CarrierWave gem?

One of my Model's attachments needs to save files on AWS S3 and the other Model should save it to Google Cloud Storage. Is this possible using CarrierWave gem?

Facebook Marketing API create Ad Creatives Error

I'm having issues creating Ad Creatives using: gem 'facebookbusiness' Facebook API version 13.0 I have successfully managed to upload Ad Images and to get the

How to get all embeds_many items in Mongoid

I'm Using Mongoid and I have two models: class User include Mongoid::Document include Mongoid::Timestamps embeds_many :tickets field :email, type: Str

bootstrap 5 on rails 6 (justify-content-center)

I am a newbie here, please avoid complex answers :) A row was created to center all of its content, it worked just fine. The form submit button and the link_to

How to order a query by translated attribute of associated model in Rails using Mobility gem

I've two associated models: class Food < ApplicationRecord extend Mobility belongs_to :food_set, inverse_of: :foods translates :name, type: :string,

Rubocop – how can I just display auto-correctable results

I would like to run Rubocop and just see auto-correctable results. The documentation (https://docs.rubocop.org/rubocop/usage/basic_usage.html) indicates this sh

How to assign an instance to a variable - .find() / .where() - and access it's values - RUBY on RAILS

account = Account.find(params[:account_id]) account_to_receive = Account.where(number_account: transaction.account_to_transfer) So I am building a bank app I wo