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
0answers
5 views

How to stream downloads with rack.hijack and IO without them cutting off prematurely?

Our UI server needs to make certain downloadable files available to users. The files live on a specialized storage server. The UI server enforces some permissions and uses HTTP Basic Auth user/pwd to ...
0
votes
0answers
8 views

Is there a way to test if PostCSS Autoprefixer is working? Specifically for Rails 6

I am writing a Rails 6 webapp using Webpacker. Its my understanding that auto-prefixing in Rails 6 works out of the box via PostCSS and its autoprefixer plugin. However I cannot verify if this ...
0
votes
0answers
5 views

Deploy Rails + React + Puma + Nginx to Heroku failed

I want to deploy RoR + React SPA to heroku as one project. As a typical production environment, use Nginx as web server and user Puma as app server. I tried to follow readme of https://github.com/...
0
votes
1answer
16 views

Edit an object Modal Ruby on Rails

Yoo, I'm trying to make a modal with which I can edit a Note. But when I click on the edit button. It opens the modal but it only display the first note's infos even clicking on the others note it ...
0
votes
0answers
6 views

Fatal error: stdio.h: No such file or directory in Heroku

I am in the process of porting an older rails app that is running on Heroku to a new Heroku instance. It appears to be built correctly. When I try to run rails console in bash, I get: In file ...
0
votes
1answer
11 views

How to state that belongs_to can't be null in a migration?

Is it possible to state that a belongs_to type of field can't be null? Right now I have the following migration: class CreatePosts < ActiveRecord::Migration[6.0] def change create_table :...
1
vote
1answer
31 views

How to publish my rails app into github pages

Hello I'm trying to find a way to deploy my Rails app into GitHub but so far i have read that GitHub can only host static sites. So i started looking for Jekyll but here is my problem: I already have ...
0
votes
0answers
16 views

db:migrate is not migrating the requested files

I am trying to run rails db:migrate but it is not executing the three pending migrations. I am running a docker container. Project files are in persistent directory on host machine. After the start ...
0
votes
1answer
30 views

Trying to install Rails 6 using RVM

I have installed RVM successfully on my Mac and using it I have installed Ruby 2.6.3. I have set my current and default version of Ruby to be 2.6.3. Everything seems to be fine because when I enter ...
1
vote
1answer
15 views

Zlib gunzip only returning partial file

I have a 27MB .gz file (127MB unzipped). Using ruby's Zlib to ungzip the file returns correctly formatted data, but the file is truncated to a fraction of the expected size (1290 rows of data out of ...
0
votes
0answers
14 views

Problem with sitemap.xml in Ruby on Rails app

I have Ruby on Rails app and I created sitemap.xml file (in public directory) with sitemap_generator gem but it can't be readable in production. sitemap.rb # Set the host name for URL creation ...
0
votes
1answer
25 views

ruby on rails active record

For this method I am having an issue with the while loop. If I enter a username that already exists it is supposed to prompt me again to enter another username but what is going on is that it is ...
0
votes
1answer
11 views

Rails form rendering multiple times if using `.build`

So I have a user form form_for that accepts nested attributes from account_prices. Whats happening is on my user controller I have this private method. def pre_build_user_account_prices if @...
0
votes
1answer
6 views

Timecop doesn't work with cucumber capybara

Sorry for my english, it's not my native language I have some time sensetive test. It's about some alert message when before event left less than 24h or more than 24h. Some part of my code to find ...
0
votes
0answers
9 views

Rails Active Storage Returning 404

On one of my user-protected pages I load an image via active storage that is saved on S3. The image usually displays, but I have instances where the image may not display and returns a 404. My S3 ...
0
votes
0answers
7 views

Rails and activemodel errors - how to render frontend vs backend specific errors

We are working on remodeling our user phones to separate (on the frontend) the selection of the phone international code prefix and the number without prefix. But on the backend side, we are only ...
1
vote
0answers
13 views

plaid ruby gem: exchange token throwing 'provided public token is in an invalid format' error

I am using Link in React to link to Items and then passing the public_token to my rails server where I'm attempting to exchange the public token for a access token. Link is successfully returning the ...
0
votes
2answers
24 views

Rails redirect loop in production, everything is fine in development

I am running into an issue with Rails where in production it generates an error in the log file, but nothing in the development mode: I, [2019-10-16T12:02:16.953954 #11866] INFO -- : [e5d5e3b6-2a9c-...
1
vote
0answers
19 views

Alternative to fat arrow function for precompile

I have some javascript written for an input mask in rails 4. The input mask works fine on the development side but fails to precompile on the server with the following error: ExecJS::RuntimeError: ...
0
votes
0answers
10 views

Enable/view console.log messages in headless Chrome

I have a Rails 5.2.3 app running headless Chrome test using Capybara, Selenium, and chromedriver. My tests run just fine, but I can't seem to enable or view any messages output to console.log. Here is ...
0
votes
0answers
7 views

Rails 5 smtp Sendgrid 451 Authentication failed: Could not authenticate

We are using Sendgrid for sending SMTP emails in our Rails 5 app, I had a weird error stating: 451 Authentication failed: Could not authenticate My configuration in production.rb file is like this:...
0
votes
1answer
14 views

Adding a reference to existing active record and adding belongs_to, breaks code

I have added a reference to an existing model: def change add_reference :price_change_requests, :price_reminder, foreign_key:true end and then add a belongs to relationship to it: belongs_to :...
1
vote
1answer
22 views

Cant connect to rails docker container on localhost

Im having trouble accessing my containerized rails app from my local machine. I'm following this quickstart guide as a template and made some tweaks to the paths for my gemfile and gemfile.lock. The ...
0
votes
0answers
4 views

Keycloak and Ruby on Rails app integration

I wanted to integrate a Ruby on rails application with Keycloak. I have mails for user registration, forgot password etc configured in my Ror application. When I register a user using keycloak, is it ...
0
votes
0answers
21 views

I want to code TicTacToe without using socket.io

I want to create a TicTacToe game using Express.js/Javascript/HTTP Requests. I don't care for a realtime 'game' application. However, I am hearing that this isn't possible and you have to use web ...
0
votes
1answer
19 views

Nested Resource Forms - Automatic Linking of Associations

I see some posts regarding nested resource forms, but none outline how one is supposed to automatically make the nested resource use the parent for the association. When I post my form, it fires the ...
0
votes
0answers
12 views

Concatenate PDF from HTTP request into Prawn PDF

I wanted to concatenate a PDF that I download from the internet into an existing Ruby Prawn document. I was using this code as my basis: https://github.com/prawnpdf/prawn/issues/376 The code does not ...
0
votes
0answers
10 views

Webpacker::Manifest::MissingEntryError with a vanilla Rails 6 application

Software versions on a macOS 10.14.6 (Mojave): $ ruby -v ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18] $ rails -v Rails 6.0.0 $ node -v v6.14.4 Setup $ rails new testshop3 $ cd ...
1
vote
0answers
34 views

Order by ActiveRecord::AssociationRelation

As the result of my query I've received ActiveRecord::AssociationRelation which I want to order by company_name. But to get these company name for one Process I have to do something like ...
0
votes
0answers
22 views

Oops!! Method index.en not found for resource items

I have used https://github.com/Apipie/apipie-rails for API docs. This is working fine with rails 4 vestion after that I have updated my rails version to this rails 5.2.3 and it stoped working. # app/...
0
votes
0answers
10 views

Configure the way file ID attribute is generated on Shrine gem

Shrine creates a random ID for the uploaded file to AWS S3 when calling presign_endpoint. Is there a way to change the way the ID is generated using Shrine's configuration?
2
votes
4answers
60 views

Loop two arrays at once

I do have an array with orders, each with a date. Like: [ #<Order id: 1, date: '2019-10-07'>, #<Order id: 2, date: '2019-10-08'>, #<Order id: 3, date: '2019-10-10'>, #<Order id: ...
3
votes
4answers
50 views

Rails - Adding a bi-directional relationship

I'm trying to setup a sample application that tracks football matches. There's currently 3x tables: Ground - The home ground of a particular team Team - The actual team itself Game - A game, which ...
1
vote
0answers
12 views

Replicating Heroku's Review Apps on AWS

I'm currently working for a client that are using Heroku and migrating to AWS. However, we're having trouble in understanding how the Review Apps feature can be replicated in AWS. Specifically, we ...
0
votes
1answer
28 views

rails has_many relation of parent not updated after save

Simplified code for Rails 5.2. A very simple Base class that adds up some value of its Items. class Base < ApplicationRecord has_many :items def values children.map(&:value).sum ...
0
votes
1answer
12 views

Identifying the right scope joins for pundit

I'm currently implementing pundit, where I am trying to identify whether or not a user has an admin role. Issue I'm trying to avoid creating a join_table between discounts and users, by leveraging ...
0
votes
0answers
29 views

Rails error: instance method already defined by another enum but there are no repeats

I am attempting to iteratively upgrade a Rails 5.2 app to Rails 6. So far I have updated Ruby from 2.3 to 2.5 and bumped a few gems and am now trying to deal with some errors that have appeared. ...
0
votes
1answer
25 views

How to create a custom route

What should I add to my routes.rb file Rails.application.routes.draw do namespace :admin do ? end end to get the following route? admin_user_archivals PATCH /admin/users/:user_id/archivals(...
0
votes
3answers
42 views

select table columns only if it matches certain conditions

Rails 5.2 ruby 2.6 Hi all, I have a model which has status and updated_at created_at columns(also has few other columns). possible status values can be 'Pending', 'Enroute', 'Completed'. I want to ...
0
votes
1answer
23 views

Select_tag rails, display value dynamically before submit

I have a form showing some available banks I can choose, using a select_tag. The selected bank is stored in params[:bank] when I submit the form What I want to do is to dynamically show information ...
0
votes
0answers
20 views

Rails Javascript form display label pass value to params

I'm using Awesomplete to help with autocompletion of a list of towns in a rails 6 application. I'm using the replace method to display the label once it's selected from the autocomplete list which ...
0
votes
2answers
26 views

Datatype validation in rails ActiveModel::Validations

I wanted to validate class attributes with respect to their data type. I am writing an API in ruby and i need to check if a particular parameter data is of type String, hash, Array etc. eg. we have ...
0
votes
1answer
24 views

Rails pull out and sort data with join

I want to pull out and sort all Process by company_name. To get company_name for one process I need to do something like this: company_name = Process.first.inquiry_field_responses ...
-2
votes
2answers
27 views

Pundit raises an error, which I wouldn't have otherwise

I'm encountering a pundit response which I didn't expect and I was wondering if someone could tell me what is happening. Issue In my index action I would like to show attractions that below to a ...
-3
votes
1answer
33 views

link_to redirecting to “SHOW' method instead of ”DELETE"

= link_to multimedium_path(f), method: :delete, data: { confirm: 'Are you sure to delete this multimedia?' } do i.fa.fa-trash.fa-lg.mr-2.text-danger When i use link_to, the button is ...
2
votes
1answer
36 views

Remove group_by field from final result rails

I am using rails 5.2.0. I have a City model in which id is a Primary key and name represents name of city. I am using group_by to achieve something like this: Expected Output: {10571=>"Μorocco ...
0
votes
1answer
30 views

Devise edit_registration now working properly

I am trying to edit the current user's information using the edit_user_registration_path. This is the code of the edit_registration.html.erb <h2>Edit <%= resource_name.to_s.humanize %>&...
1
vote
1answer
33 views

Cannot Maintain Session on Page Refresh

I have an app built with Rails, React, and Webpacker. I'm using token based authentication, so when a user creates an account or signs in they are assigned a token in the DB. This token is then used ...
1
vote
1answer
19 views

ADFS SAML Identity provider redirects to service provider with status “Responder”

I am using omniauth-saml to authenticate users on a Ruby on Rails application. Authentication has worked well, until we stated attempting to work with companies using ADFS (Windows Active Directory). ...
1
vote
1answer
12 views

How to integrate gem using Webpacker instead of the asset pipeline? [Rails 6]

I want to use the local_time gem, but as per its installation instructions it should be included in the asset pipeline: Installation Add gem 'local_time' to your Gemfile. Include local-...