1,027 questions
1
vote
1
answer
2k
views
Javscript using importmaps not working looking for modules under assets
I am trying to convert my rails 7 application using sprockets to use import maps because I was having issues using turbo and hotwire. I am not using bootstrap or tailwind. We are using materialize.
...
1
vote
0
answers
39
views
Uncaught TypeError: App.Routers.Maintenances.MyRouter is not a constructor
I am using backbone js as frontend in rails 7 application. In index.html file I have called backbone main file. code is coming in this file. But here I have initialise router file. In which getting ...
1
vote
0
answers
365
views
turbo_method: :delete not working for destroying users in Rails 7
Can anyone tell me why the following is not working in Rails 7?
<%= link_to "delete", user, data: { turbo_method: :delete } %>
The expected action was a DELETE request routed to the ...
3
votes
1
answer
2k
views
Rails 7 and Bootstrap error in stimulus - failed to resolve module specifier bootstrap
I am following this tutorial: https://www.hotrails.dev/articles/rails-modals-with-hotwireEverything goes well until I create this stimulus controller file:
import { Controller } from "@hotwired/...
2
votes
1
answer
341
views
Using ERB in Markdown with Redcarpet in Rails 7.1
I am trying to add Markdown support in Rails 7.1.1 app.
Redcarpet gem version is 3.6.0.
I follow advice from this question:
Using ERB in Markdown with Redcarpet
My current code (in /config/...
1
vote
1
answer
188
views
Rails 7 won't generate a destroy path for the comment deletion [closed]
I'm trying to make a delete helper for a comment, this is the html code :
<% if store_comment.user_id == current_user.id %>
<%= link_to 'edit', edit_store_post_store_comment_path(params[:...
0
votes
0
answers
62
views
ActionController::ParameterMissing while trying to POST
I have a simple email signup form that for now only accepts your email. However, if I try to post, I get the following error message
Started POST "/landing" for 127.0.0.1
Processing by ...
1
vote
0
answers
425
views
How to tell Zeitwerk to ignore overrides folder in a rails engine?
In the latest Rails 7.1.2 my engines have stopped working with the following error
Zeitwerk::NameError:
expected file /home/jamie/Development/rails/comtech/r7/ccs_cms/engines/admin_dashboard/app/...
0
votes
2
answers
3k
views
Getting in `require': cannot load such file -- ffi (LoadError) after installing gem 'font-awesome-sass', '~> 4.7.0'
Im using windows. I wanted to include font awesome icons to my project and so I added gem 'font-awesome-sass', '~> 4.6', '>= 4.6.2' to my gem file did a bundle install and got this:
Fetching ...
1
vote
1
answer
271
views
Can't delete User due to SQLite3::ConstraintException: FOREIGN KEY constraint failed (ActiveRecord::InvalidForeignKey) error
I'm a beginner working on a Ruby on Rails application where I want to ensure that deleting a user also deletes their associated messages, participants, and rooms. I have set up associations, but I am ...
1
vote
2
answers
81
views
Dropping a part of the URL in Rails
I have a setup where I route all requests for /upload/* to Rails. Using the blog example, I want somedomain.com/upload/article/new to be treated as somedomain.com/article/new by Rails. I ended up with ...
1
vote
1
answer
342
views
How to load an Active Storage image into a canvas with a Stimulus controller?
I would like to load the images that users submit into the Stimulus controller so that I can use it within my Three JS (3D JavaScript Library) code. How can I achieve this? I’ve already tried so many ...
0
votes
1
answer
154
views
JQuery event listener error when using it with Rails 7
I have only added the JQuery using CDN, I placed the code in the head, in _head.html.erb which is this one :
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="...
1
vote
1
answer
837
views
Modals not working in Bootstrap for Rails 7
I'm using the Bootstrap gem in Rails 7.
I'm just trying to get a simple Bootstrap modal working.
The dropdowns in the app work fine, so I assume JS is setup correctly, but just in case:
importmap.rb:
...
13
votes
2
answers
6k
views
Rails 7.1, log to STDOUT and log/production.log
In a new Rails 7.1.2 app, the following lines can be found in config/environments/production.rb:
config.logger = ActiveSupport::Logger.new(STDOUT)
.tap { |logger| logger.formatter = ::Logger::...
1
vote
2
answers
1k
views
How to render partials recursively with turbo frames and stream
Hello, I'm relatively new to Turbo Streams and Frames, and I'm currently facing an issue with rendering replies to comments using Turbo Frames and Streams.
Let me explain my setup. I have a Comment ...
0
votes
1
answer
204
views
Render and/or redirect were called multiple times in this action. You may only call render OR redirect, and at most once per action issue
When I am changing the page using pagination button or using the scrobble bar in the kanban board card getting DoubleRenderError in Ruby on Rails occurs when I attempt to both render and redirect in ...
1
vote
1
answer
349
views
Turbo Streams in Rails 7
I have been following this tutorial https://www.youtube.com/watch?v=TKIbtbYyRdE&list=PL6SEI86zExmvb4qjVHJWrKRQrKjWksQ81&index=34 followed by its 2nd part
https://www.youtube.com/watch?v=...
0
votes
0
answers
99
views
rails paths are broken in docker container
I have a rails project which on rails s loads and runs fine. but when I containerize the application, required modules in lib folder are not loaded and could be not found in the docker file structure. ...
0
votes
1
answer
36
views
cannot upload image in comment form in rails 7
This is my form :
<form action= "<%= store_post_store_comments_path(params[:id]) %>" method="post">
<div class='field'>
<textarea name="...
0
votes
1
answer
343
views
Using "after" does not have any effect in a Rails Migration
I have generated the migration file and added t.string :address. before ''' rails db:migrate''' I added the line-
add_column :users, :address, :string, limit: 10, after: :email
but it was added last ...
0
votes
1
answer
193
views
Controller integration tests lose the session after follow_redirect
When testing a rails 7 controller everything works splendidly until I get a redirect and then execute a follow_redirect!. At this point the session mysteriously disappears and my tests can no longer ...
0
votes
1
answer
147
views
Menu "flashes" in Rails 7 and Turbo
I am trying to build a very simple menu with submenus using Rails 7, Bootstrap 5 and Jquery.
HTML:
<div>
<button class="toggle-submenu">Sales</button>
<div ...
0
votes
1
answer
116
views
Unpermitted Params using Polymorphic Association in Rails 7
Based on image above, I do a simple example.
Model: Person
class Person < ApplicationRecord
belongs_to :personable, polymorphic: true
end
Model: Customer
class Customer < ApplicationRecord
...
0
votes
1
answer
118
views
How to configure Rails to use subfolders in models with RSpec?
I have subfolders inside the models folder:
app/models/foos/bar.rb
Autoload paths is configured in application.rb:
module AppName
class Application < Rails::Application
config.load_defaults 7....
1
vote
1
answer
95
views
Trouble passing a data structure from Rails 7 to a javascript function
I need to preserve the structure in a data-tinymce html tag to pass to a javascript function but the structure is somehow not being preserved and this is causing the method in the javascript function ...
4
votes
2
answers
953
views
Activeadmin Rails 7 Tailwind Issue
Just install active_admin in rails 7 and ruby 3.1.0
gem 'activeadmin', github: 'activeadmin/activeadmin', branch: 'master'
It add two style files. One is active_admin_old.scss
and other is ...
1
vote
0
answers
452
views
Rails 7 with turbo and JS event listeners
I use Rails 7 and turbo. I want to use a Bootstrap 5 admin theme but having the following issue:
To bind the click event to the menu toggle button, there is some code like this:
let menuToggler = ...
3
votes
1
answer
208
views
Rails javascript delegation for tinymce-rails in a nested fields partial
Using the tinymce-rails gem in a Rails 7.1 engine, I have a form partial and a dynamically added nested fields form _page_section_fields partial, the nested fields form has a text area that makes use ...
9
votes
3
answers
3k
views
Rails 7.1.1 - spawning error occurred - passenger - You have already activated stringio 3.0.0, but your Gemfile requires stringio 3.0.8
When upgrading to the latest version of rails, I'm experiencing the following error with passenger refusing to start.
The application encountered the following error: You have already activated ...
1
vote
1
answer
1k
views
Rendering template dynamically in Rails ViewComponent
I have a SectionComponent Class as follow :
class SectionComponent < ViewComponent::Base
def initialize(..)
...
end
end
And a matching section_component.html.erb file.
It works perfectly ...
3
votes
1
answer
532
views
Set-Cookie header in rails 7 wrongly set as array
So, i recently created a rails 7.1 application and came about this weird thing: the headers are not properly set. It looks like the Set-Cookie header instead of getting repeated for every element of ...
2
votes
0
answers
1k
views
Next.JS 13.4 Cookies() Function Works In Route Handler In Development But Not Production
This seems to be touched on in this question Next.js 13 Cookie value not retrieved from Route Handler, but the answer there isn't working for me.
I have a Nextjs 13.4 frontend and a Rails 7 API-only ...
4
votes
2
answers
2k
views
Bumping to Rails 7.1 broke devise authentication, but not on development
I bumped my application to Rails 7.1, and on my development server, signing in using my Devise setup works fine. However, on my staging server (RHEL7 using nginx), authentication no longer works.
At ...
0
votes
1
answer
536
views
How to use JavaScript in Rails 7?
I want to have a JavaScript file available for a view in my Rails app.
// app/javascript/custom/manage.js
document.body.style.backgroundColor = 'lightblue'
const test = document.getElementById('test')...
1
vote
2
answers
777
views
How can I override PostgreSQL's gen_random_uuid() in Rails?
I want to prepend a string to the uuid generated by PostgreSQL's gen_random_uuid() to use as the uuid for one of my models (it won't be the primary key).
Think like Stripe's price and customer ids - &...
1
vote
1
answer
422
views
Rails engine importmap Uncaught ReferenceError: tinymce is not defined
I am using importmap with a downloaded version of tinymce in a rails 7.1 engine. I am failing to get the editor to display and the browser console shows the following error
Uncaught ReferenceError:...
0
votes
0
answers
830
views
Rails 7, dynamically setting the session cookie by domain & subdomain
I have a Rails 7 SaaS app using Devise for authentication, that signs up a new user on the www.my-site.com subdomain and redirects them to the actual app after signup at dashboard.my-site.com. Also, ...
1
vote
1
answer
465
views
Rails 7 Action Cable with Puma, Nginx, Docker Swarm
I setup a DigitalOcean Ubuntu 22 droplet to host a docker swarm with containers for a rails app, postgress, and redis. I’m not able to get action cable to work with puma and nginx. I see errors in the ...
12
votes
4
answers
4k
views
How can I fix "Unknown enum attribute" after Rails 7.1 upgrade?
Hi I have this Company model with the following enum that works fine for rails < 7.1
class Company < ApplicationRecord
enum auth_type: {
password: 'password',
magic_link: 'magic_link',...
0
votes
3
answers
1k
views
how to resolve pending migration error in rails 7
I have created a migration in which i mistakenly duplicate the columns of "created_at" , now my screen is displaying this error, after when i remove the duplication, the errror was also same ...
1
vote
1
answer
265
views
Maplibre and Rails 7 importmaps
in config/importmap.rb:
pin "maplibre-gl", to: "https://ga.jspm.io/npm:[email protected]/dist/maplibre-gl.js"
However, trying to use this library: import * as maplibregl from &...
0
votes
1
answer
127
views
Rails 7 | User Logging Out Automatically
I have a rails app in production and i am having cookie problem.
i have,
www.domain.com
domain.com
so my payment processor is logging the user out after a payment transaction if i use domain.com
So ...
0
votes
0
answers
36
views
How to keep modal open if errors exists for devise?
I have a Modal that has a devise form for authentication. If I click keep the fields clear and click on 'Sign Up', the errors do appear on the modal but the modal closes. How do I keep the modal open ...
0
votes
2
answers
209
views
Rails 7 | GET Request not working in Production
I have a rails 7 app where when the user clicks the button, it redirects to a payment gateway for doing payments online via GET Request, in my development mode, in local machine (on localhost:3000), ...
5
votes
0
answers
2k
views
`Cannot get a signed_id for a new record.` with `url_for` after attaching picture in Rails 7.1 [closed]
When upgrading to Rails 7.1 we are getting an error when trying to use url_for in the response when creating a new record.
After creating a chat object with one attached picture, the response includes ...
1
vote
1
answer
165
views
ActiveAdmin: render index table of has many resource in show page of parent
Trying to build this with Active admin 3.0. This seems so basic to me that I feel I must be missing something.
Let's assume I have a Store model and an Employee model and a store has many employees ...
0
votes
1
answer
147
views
Assigning a numeric/epoch value to scheduled_at is deprecated in Rails 7.1.0.rc1
I'm getting a deprecation warning when upgrading to Rails 7.1 and Google has no search results!
The warning is DEPRECATION WARNING: Assigning a numeric/epoch value to scheduled_at is deprecated. Use a ...
1
vote
0
answers
46
views
redirect_to doesnt take effect
I have a controller and inside the controller
def publish
post = Post.find(params[:post_id])
post.update(published: true, published_at: Time.now)
redirect_to edit_post_path(post)
end
def ...
0
votes
1
answer
313
views
Rails admin with zeitwerk
Hi i am having a application built in rails 6 and i am trying to update it to rails 7 but there's some problem i am facing with zeitwerk.
in the rails admin initilizer
# initilizer/rails_admin.rb
...