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.
ruby-on-rails
338,241
questions
0
votes
0
answers
8
views
finding the appropriate session for an IdP single logout request with Ruby SAML
I'm putting together a gem for our Rails apps to use SAML single sign-on/logout via Entra ID. I had some questions about the final bit I need to implement: ID provider initiated single logout requests....
-1
votes
0
answers
13
views
Is there a way of connecting an app running Rails 6.2 on Heroku with a persistent file system somewhere on the cloud? [closed]
We are running a Heroku app built on Rails 6.2 with Postgres and Redis. For some of the processes we need to run, we must keep a proper persistent file system. AWS S3 will not work for our needs. ...
1
vote
0
answers
37
views
How to set view context in Rails?
I’m building a gem that intercepts Rails’ default render behavior. Instead of rendering a view, it looks for a helper method that corresponds to the current controller’s action name; it then uses the ...
0
votes
0
answers
22
views
React Component in Rails App Appears on Localhost but not Heroku Production
I have a Rails 7 app (esbuild, NO webpacker) with multiple React components, most of which work perfectly on localhost and in my Heroku production environment.
Weirdly enough, this one component is ...
0
votes
0
answers
15
views
Rails 7 actiontext embedded images
Using trix 2.1.2, Rails 7.1.3.4, I'm able to create a message with an embedded image (using google for active storage) and it displays when I first create the message and also when I "show" ...
0
votes
0
answers
34
views
Do I need a Transaction here or am I fine with just a Lock?
I have this table:
create_table :api_usages do |t|
t.references :api_key, null: false, foreign_key: true
t.date :billing_date, null: false
t.integer :request_count, null: false
t.timestamps ...
0
votes
0
answers
47
views
Devise gem bundled but server indicating error
I am a newbie and would need some assistance. I added devise gem to my Instagram clone app and added "sign up", sign in", "sign out", and "edit profile" links onto ...
-1
votes
0
answers
25
views
Can't get bootstrap dropdown in my header to work after changing pages
Using Ruby on Rails and Boostrap 5.3 to create a site to host my projects and info. I have a header file containing all of my navbar code. After visiting any link from one of the dropdown options, the ...
0
votes
0
answers
11
views
Creating batch classes on BigBlueButton using greenlight V3
I've been using greenlight v2 until very recently, and since I'm dealing with large number of classes every semester I came up with this code to create batch classes in greenlight using Ruby on rails:
...
-1
votes
2
answers
65
views
How can I update how ActiveRecord::Base#where interprets ranges?
It appears that ActiveRecord::Base#where partially distinguishes between ranges defined with 2 dots (0..) and ranges defined with 3 dots (0...).
E.g.
> User.where(id: ..0).to_sql
=> "SELECT ...
0
votes
3
answers
62
views
authentication from scartch in rails
Hi i am learning rails from the Odin project and i am creating a simple authentication without using devise . the course doesn't really give enough info to help beginners finish that project
so, Here ...
1
vote
1
answer
36
views
Rails form_with-helper: What is a :scope?
I'm currently reading the Ruby on Raily API-documentation. Specific the part about the form_with helper: https://api.rubyonrails.org/v5.1.7/classes/ActionView/Helpers/FormHelper.html#method-i-...
0
votes
0
answers
25
views
+50
Turbo-Stream broadcast and Sidekiq job - Job runs, but page does not update
Trying to run a sidekiq job then broadcast the updated attributes to the page assuming the user is sitting there watching it.
I'll try and list all relevant code:
cable.yml
development:
adapter: ...
0
votes
2
answers
49
views
How to access associated objects in a nested form
How do I use a nested form, for an object association, but display values from both the associated object, and the object association itself?
Excerpt of the nested form:
<%= form_with model: @...
0
votes
0
answers
30
views
Rails 7.1 redirect_to(Shibboleth Logout) is not working
I am not sure how to debug Rails 7.1, redirect_to() not working vs in Rails 3.2 the same exact code works.
Working Example
Within Rails 3.2, I have a Controller action "logout" that contains ...
0
votes
1
answer
75
views
Rails 7 error during application start - Zeitwerk-related errors
I'm upgrading my rails app from 6.1 to 7.0 and i'm running into this runtime error:
I do use the Authlogic gem, but the odd thing is i have no config/initializers file for Authlogic, and i can't find ...
1
vote
1
answer
56
views
How to automatically derive foreign key column names with polymorphic associations?
In my Ruby on Rails 7 application I have a large Account model with various has_many associations (most of them are left out for brevity here):
class Account < ApplicationRecord
has_one :...
0
votes
1
answer
31
views
xapian-full-1.2.3 not able to install succesffully
Application not starting after ubutu patch upgrade.
/home/azureuser/app2/current
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent ...
-1
votes
0
answers
24
views
Implement prometheus and garafana for a ruby on rails application [closed]
I am looking for a help to implement prometheus and garafana in my rails app. I have tried using prometheus-client and yabeda-prometheus gem. I have also tried with prometheus-exporter gem but all in ...
0
votes
0
answers
17
views
Reload ajax datatable in rails
im using rails 7 with server-side ajax datatable. When delete a row and call reload(), it doesn't reload datatable. It used to work with rails 6.
When I click on delete button, it deletes de data row ...
0
votes
0
answers
37
views
Rendering of select options appears correct in code, not in window
The following rails helper method aims to give a select menu with options that have the background of the value (which represents a color)
def options_with_colors(colors)
colors.collect do |...
0
votes
0
answers
62
views
Ruby (3.3.4) and Rails (7.1) - rails s Zeitwerk - uninitialized constant Utils::ScriptsUtils::Utils (NameError)
I am trying to update my ruby app from ruby 2.6.6 to ruby 3.3.4 and Rail 5.1 to Rails 7.1
I know it is not a good practice to do so, but in my case (which is a bit complicated) I felt I didn't have ...
0
votes
0
answers
33
views
JSON serialization with a group by query ... how to?
I have an API endpoint to pull a big JSON blob from one of my models, and it works, but I'd like to improve it. The current implementation is below, and mostly just works using built in associations.
...
0
votes
1
answer
48
views
Rails Internationalization – Lazy Lookup with a Presenter class
4.1.4 of the Rails Guide explains "Lazy" Lookup for the Internationalization gem.
As an example:
en.yml
en:
clients:
show:
good_client: 5 Star Client
app/views clients/show....
0
votes
3
answers
59
views
Alternative to "pluck" for a single record
In Ruby on Rails, the array method pluck works either if the things are objects or hashes. E.g.
array_of_hashes = [
{ name: "Alice", age: 25 },
{ name: "Bob", age: 30 },
{ ...
0
votes
1
answer
50
views
Ruby on Rails: how to efficiently save nested attributes (recursively)?
I'm using Rails 6.1.3.2 and trying to make saving of nested attributes more efficient. The database used is MySQL.
Code basis
BoardSet.rb
class BoardSet < ApplicationRecord
has_many :boards, ...
0
votes
1
answer
33
views
Trying to render partial but The response (500) did not contain the expected <turbo-frame id="">
Trying to learn this a bit, but keep running into new issues.
Currently, I have an 'explore' button that is supposed to run some controller code, and pop out a new _partial where it counts down and ...
0
votes
0
answers
35
views
Apache Passenger Rails vhost failing after Ruby and Rails upgrade
I recently upgaded three Rails applications: UAM, Proposals, and Projects from Rails 5.2 to 6.1.7.7 and from Ruby 2.7.4 to Ruby 3.3.1.
The three applications were previously split from the same ...
1
vote
1
answer
23
views
Define and use a function within the same HAML file
I've got a light-weight haml-based site that I'm building with Middleman (not Rails, but I'm tagging this with Rails because I think Rails people might know the answer).
Is it possible to define a ...
0
votes
1
answer
24
views
Invalid rendering array with locals and as by PropsTemplate gem
I use gem props_template and I need to render array with some partial and additional local, I use something like
json.array! @orders, partial: ['shared/order', locals: {employee: current_employee}, as:...