Skip to main content

Questions tagged [ruby-on-rails]

Ruby on Rails is an open source full-stack web application framework written in Ruby. It follows the popular MVC framework model and is known for its "convention over configuration" approach to application development.

Filter by
Sorted by
Tagged with
0 votes
0 answers
14 views

Zeitwerk and Namespacing STI Models

I am trying to figure out an issue I am having with my rails app that involves namespacing some sti models. Originally, I had a collection of sti models located in: app/models/foo I validated these ...
dukehenry's user avatar
0 votes
1 answer
27 views

What is best way to set time in a Rails app form so that the time is the same once I enter it and doesn't change?

I have a Rails 7 form where I enter in data to populate a database. I have a start_time and end_time in the form: <%= f.time_select :start_time, :value => Time.now.strftime('%I:%M %p') %> <...
mwhocl's user avatar
  • 77
0 votes
0 answers
24 views

rails migration to version 7 still defaults to HTML

Having migrated rails from 6.1 to 7.0, forms or button_to are still processing as HTML <%= button_to change_shops_for_analysis_promotions_path, method: :post, params: {shop_id: shop.id, toggle: 0},...
Jerome's user avatar
  • 5,989
1 vote
1 answer
26 views

Rails: How does form_with know, which Controller-action to invoke?

Taken this form as an example: <%= form_with model: @product do |f| %> <!-- ... --!> <% end %> The routes-file: get "/products", to: "products#index" get &...
cluster1's user avatar
  • 5,388
0 votes
0 answers
24 views

How to handle session managment in ruby on rails app with mixed structure monolithic and api using devise and devise jwt

I have a Ruby on Rails 7 app with devise to handle Registration and session managment for 3 models, Admin, Company and Users. Company has_many users, Admin and Company works in the monolithic ...
Giordano Díaz's user avatar
1 vote
0 answers
21 views

What are the differences between these migrations to make database column non-nullable (Ruby on Rails)?

I have been working with rails recently (pretty new to the whole thing) and I had a question about a concept I was learning about. So I learned about validations that occur at the model-level, but I'm ...
Julian Biju's user avatar
0 votes
0 answers
31 views

Login Issue: Unable to redirect to multiple sub-domain with masquerade

Users cannot maintain their login sessions when switching between different subdomains within the same application. I have a multi-tenant app. Recently, I successfully installed the devise-masquerade ...
Abhishek Tanwar's user avatar
0 votes
0 answers
15 views

Rails 7 ActionMailer SMTP server with ntlm

I try to setup ActionMailer with NTLM. I use this gem https://github.com/macks/ruby-ntlm and this example Ruby/Rails ActionMailer not working with NTLM. My configuration is: config.action_mailer....
Myth Rush's user avatar
  • 1,107
0 votes
0 answers
21 views

First ruby on rails deploy to Render - mistake appears

Trying to deploy first ROR app to Render. Using following: original manual from official render's site - https://docs.render.com/deploy-rails#create-a-new-project https://www.youtube.com/watch?v=...
Bob Richie's user avatar
0 votes
0 answers
21 views

migrating to rails 7 testing manifest.js error

in migrating an application to rails 7.0 the following warning is issued; DEPRECATION WARNING: ActiveRecord::Base.default_timezone is deprecated and will be removed in Rails 7.1. Use `ActiveRecord....
Jerome's user avatar
  • 5,989
0 votes
0 answers
27 views

Heroku : ruby app, issue when i tried to push it

i create an app on ruby on rails with heroku this app already exist online now I try to push a new version of this one on heroku, but i have an issue. i already update my ruby and rails version (...
Fabien Goussen's user avatar
0 votes
1 answer
34 views

problem installing Rspec with factory_bot. Factories are not registered

I am using rails 7.1.3.4 with rspec-rails 6.1.3 and factory bot. I have added require 'factory_bot_rails' and config.include FactoryBot::Syntax::Methods in spec/spec_helper.rb Here is my factory in ...
Syl's user avatar
  • 3,819
0 votes
0 answers
12 views

Elastic Beanstalk error 128 "No url found for submodule path 'aws-elastic-beanstalk-cli-setup' in .gitmodules" in Windows

I have inherited a Ruby on Rails app hosted on AWS and managed by Elastic Beanstalk. I have completed the setup, with my AWS credentials, including separate ssh keys for both the staging environment. ...
Onikoroshi's user avatar
0 votes
0 answers
28 views

Rails 7.1 Turbo stream not working on localhost, but works when deployed to Heroku

I have a very simple Rails 7.1.3.4 app that is essentially a dashboard, where it uses Turbo Streams to display model attributes in real-time. When I deploy my app to Heroku, everything works as ...
dizzy33's user avatar
1 vote
1 answer
19 views

How to save emails sent with Noticed gem

I need to save all sent emails to database. The usual way I would do it would be to add a custom delivery job to ApplicationMailer and handle it in that job (I got the idea from https://engineering....
fpiskur's user avatar
  • 65
0 votes
1 answer
43 views

Model method not recognizing parameters

I'm building a rails app where users can search through "Playlists", which is an object containing a title, image, and tracks. I've defined a search method in the Playlist model that takes ...
Jillian Hoenig's user avatar
1 vote
1 answer
38 views

Saving an associated polymorphic object duplicates it

I have two models, one of them being polymorphic and second one being a "parent" one: class Person has_one :asset, as: :assetable accepts_nested_attributes_for :asset end class Asset ...
mbajur's user avatar
  • 4,468
1 vote
1 answer
37 views

Ruby on Rails - How do I access the HTTP status code in my ERB view?

Suppose I have a controller which sometimes renders the view normally, and sometimes renders the view with HTTP status code 409. How do change what is displayed in the view based on the status code? I....
Jimmy Li's user avatar
0 votes
0 answers
16 views

Can't activate jar-dependencies-0.3.10, already activated jar-dependencies-0.4.1

I'm getting this error. can't activate jar-dependencies-0.3.10, already activated jar-dependencies-0.4.1 Please help me My project has gem 'jar-dependencies', '0.4.1' but in my system it was ...
ankit susne's user avatar
0 votes
0 answers
32 views

how do i fix incorrect mysql library version in ruby on rails?

im trying to make an application that connect to a mysql databse, but whatever i do, i kept making zero progress because i cant get past this line Incorrect MySQL client library version! This gem was ...
Mael Paquette's user avatar
0 votes
0 answers
36 views

what is the better way to add conditional routing in rails

I have to change the route in a way that I need to have the original route as well as change the path of the route in a env is available. this is how I am thinking of doing custom_org = ENV['...
Burhan Gardezi's user avatar
0 votes
0 answers
25 views

Destroying scheduled jobs from Solid Queue

I have a Rails app that allows users to sign up and add a list of friends or loved ones with their birthdays. The app will then email the user on their loved ones' birthdays (reminder). To achieve ...
Juzer Shakir's user avatar
0 votes
0 answers
46 views

MYSQL/Rails Database design for linked objects best practice? [closed]

I have a ruby/mysql question inquiring what the database structure best practice is: A - The set-up I have 2 objects, (e.g., employees and documents), in this example, I would like to allow some ...
jmc's user avatar
  • 19
0 votes
1 answer
41 views

Rails: Extended class that calls another extended class

Setup: We got an initializer (in config/initializers) that requires a file where we define our extensions. This file does something like this: module UbiquoExtensions end :SomeClass.include!(...
raquelhortab's user avatar
0 votes
0 answers
25 views

localhost:3000 not working when I start a docker container for my Rails project

I was following a tutorial on how to Dockerize a brand new Rails 7 app. I made the Docker container 'distant-mirror' Setting up the Docker container took about two hours, but now I entered in my ...
Noop Noop's user avatar
0 votes
1 answer
33 views

Can I pass an argument and sort using ransack

"I want to display the exact ID at the top when searching. For example: select * from user order by user.id = 25 DESC, created_at DESC; How can I implement this using ransack?"
Kuri's user avatar
  • 27
0 votes
0 answers
33 views

HABTM relationship / validates associated: valid? is true even though I don't think it is

I made the following join table to be used in a HABTM relationship between tasks and itself: create_table :tasks_tasks, id: false do |t| t.belongs_to( :dropoff_task, null: false, ...
rwg05's user avatar
  • 127
0 votes
0 answers
16 views

Issue with rails hotwire trix textarea resize

im trying to create a textarea resize grippie more or less like the SO for a trix textarea with rais stimulus so i set this controller below the issue is when i pull down the textarea the textarea ...
jjplack's user avatar
  • 113
0 votes
0 answers
23 views

RPush sending APNs 403/InvalidProviderToken

recently I'm struggling with adding APNs feature to my Ruby on Rails(7) project using RPush. I made some wrong config before and that lead to a failed launch of rails s, then I found and fixed it so I ...
David Hu's user avatar
0 votes
2 answers
70 views

Model VS Active record in ROR

Can somebody please explain me the difference between model and active record in simple words ? Is active model and model same ? PS: Knowledge regarding these topics will be appreciated. I am newbie ...
Anuja Sharma's user avatar
0 votes
1 answer
32 views

Why can't I wrap Sidekiq.configure_server in Rails after_initialize?

After upgrade to Rails 6 the initializers/sidekiq.rb is causing deprecation warnings about class autoloading. As a workaround I thought I could wrap the contents of Sidekiq.configure_server in Rails....
jva's user avatar
  • 2,817
0 votes
0 answers
43 views

Rails: problem with "@hotwired/turbo-rails" and redirects

// app/javascript/application.js import "@hotwired/turbo-rails" import "controllers" import "trix" import "@rails/actiontext" import Rails from "@rails/ujs&...
Steven's user avatar
  • 13
1 vote
0 answers
13 views

Ruby/Rails Bunny RabbitMQ Must be one of [:method, :headers, :body, :heartbeat]

I get an error when trying to connect to RabbitMQ. Error backtrace: .../amq-protocol-2.3.2/lib/amq/protocol/frame.rb:67:in `decode_header' Error: Must be one of [:method, :headers, :body, :heartbeat] ...
Ammypka's user avatar
  • 11
0 votes
0 answers
43 views

How to delete cookies in Rails 7.1?

I recently upgraded my Rails app from version 7.0.4.3 to version 7.1.3.4 and cookies.delete stopped working. I'm setting a cookie in JavaScript with: document.cookie = `last_guess=value; path=/`; ...
ptrlaszlo's user avatar
  • 337
1 vote
1 answer
61 views

Rails Custom Middleware not being recognized in GH CI

I'm using custom middle ware for the first time to normalize error handling. I have my middleware defined in app/middleware/error_handler.rb and using in my main application.rb ... require_relative &...
Int'l Man Of Coding Mystery's user avatar
0 votes
0 answers
40 views

Generate a PG dump when click a button

im creating a rails app (basically a monolith). currently, im creating a new feature, "when i click some button, it download a sql script with db backup". i understand that i can execute ...
Nicolás's user avatar
0 votes
0 answers
30 views

Docker, nginx, Rails, Puma. Static files are not served but should be

I tried to migrate from Passenger to Puma in a Rails 5.2 project. This is a Docker setup using nginx to redirect from http to https and forward the requests to the Rails container. I had this set up ...
MDickten's user avatar
  • 139
1 vote
0 answers
32 views

Rails 7.1 Error when reading active record model from redis cache

We have a problem during upgrade Rails from 7.0.8 to 7.1.3.2 with reading AR models from Redis cache. We have several places where we cache AR models with Redis: Rails.cache.fetch("key_name")...
S. Chekan's user avatar
0 votes
1 answer
39 views

Both controller level and Model level metadata simultaneously in the same column of record. how to store in PaperTrail: versions table

I'm encountering an issue with PaperTrail in my Rails application where I'm trying to store both controller-level and model-level metadata in the versions table, but only the controller-level metadata ...
Mohan Mali's user avatar
0 votes
0 answers
18 views

:en is not a valid locale when running "rails generate ims_lti:install"

I'm pretty inexperienced with both stackoverflow and Ruby. Please help me to help you to help me. I'm trying to implement ims-lti in an open source Rails application. When I run rails generate ims_lti:...
user3334278's user avatar
0 votes
0 answers
24 views

Storybook Configuration with Ruby on Rails [closed]

I'm trying to follow the view_component-storybook configuration. I've replicated everything on my windows machine and the static preview pages also work. But the storybook playground doesn't render ...
Vipul Shinde's user avatar
0 votes
2 answers
53 views

Is there an easier way to write this down and prevent duplicate code?

I am using middleman (Ruby on Rails) with HAML. I have code like this at the beginning of each page: - if pageversion == "test" - domain = data.testvars.domain - action_url = data....
ZundraDolo's user avatar
0 votes
0 answers
22 views

Minitest array check in indifferent order

assert_equal [ '2e', 'd4', '9d', '1a' ], ids is a statement to verify what array one is dealing with. But often, with fixtures, there is no necessarily set order. How can the test be written to ...
Jerome's user avatar
  • 5,989
0 votes
1 answer
48 views

How do I remember where user left in rails

In rails how do I remember which page user left at with user login. When same user comes back he lands on the same page. I am new to rails not sure how I can approach this problem. Is there any gem to ...
Manav's user avatar
  • 649
1 vote
0 answers
27 views

Why Tailwind CSS doesn't works with public/*.html files in my Ruby on Rails project

I'm using Tailwind CSS for my Ruby on Rails project, the CSS works fine with all the layouts in views but it doesn't works with public/*.html files in my project. I have a 404.html page and a 500.html ...
Ansari Junaid's user avatar
0 votes
0 answers
43 views

Rails: problem with handle redirect with turbo_stream in apps

In the application, when creating a feature, it was necessary to add hotwired/turbo-rails. // app/javascript/application.js import "@hotwired/turbo-rails" import "controllers" ...
Steven's user avatar
  • 13
0 votes
1 answer
53 views

Your Ruby version is 2.6.10, but your Gemfile specified 3.3.0

I've gone through all of the fixes for this. I do not/nor have I ever had ruby 2.6.10 installed on this machine. I'm not sure where this came from. I tried regressing to ruby 3.2.0 for something but ...
Int'l Man Of Coding Mystery's user avatar
0 votes
1 answer
95 views

Solid Queue isn't processing jobs in queues

I'm using the Solid Queue library to send emails. I followed the instructions provided in it's README file and videos from the GoRails & Webcrunch. Once the database is setup with Solid Queue ...
Juzer Shakir's user avatar
0 votes
0 answers
58 views

Error while installing ruby on rails on windows 11

I'm trying to install Ruby on Rails, but when I run the command "gem install rails", PowerShell throws this error: C:\Users\milos>gem install rails Using rubygems directory: C:/Users/...
Milda's user avatar
  • 1
-2 votes
1 answer
42 views

How to convert this sql query to active record query in rails? Need a solution for mysql database [closed]

SELECT * FROM users CROSS JOIN JSON_TABLE(campaigns_list, '$[*]' COLUMNS ( campaign_name varchar(100) PATH '$.campaign_name', campaign_id varchar(100) PATH '$.campaign_id' ) ) AS j WHERE ...
Parasmita's user avatar

1
2 3 4 5
6765