Alfred Montalvo Jr


6,460 Experience
48 Lessons Completed
2 Questions Solved


I’ve added an node express proxy server to an Ubuntu Digitalocean server that is used by my rails app and is deployed via Classic Hatchbox app that utilizes an nginx configuration file.

The node express proxy server is running on port 7000 on the DO Ubuntu server and I can view the get response from the express proxy server without any problems when I use the IP address for the Ubuntu server in the URL (xxx.x.x.x:7000/folder/file.html).

And I’m getting the following errors on the browser window when I try to access the node express proxy server on port 7000 via my rails app.

"Unable to connect ... can’t establish a connection to the server at"


"Unable to connect ... can’t establish a connection to the server at localhost:7000"

I've tried adding the nginx server block below to the sites-enabled nginx config file and the rails website goes down without any errors and I'm unable to find a log file on the Ubuntu server to try and debug the problem with nginx.

I also executed the following command (sudo nginx -t) after saving the update below to the nginx config file and it executed without any errors.

listen 7000;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# location /overview {
# proxy_pass$request_uri;
# proxy_redirect off;
# }

Is there any way that I can add an express proxy server running locally on port 7000 to my rails app via an update to the nginx config file?

I have listed the environment specs below:

OS : Ubuntu 20.04
Classic Hatchbox/NGINX
ruby : 3.0.0
node : express, cors and axios

There is no charge for AWS Cloud 9. And there is a free tier for an EC2 instance. If your AWS Cloud9 environment makes use of resources beyond the free tier, then you are charged the normal AWS rates for those resources. I have pasted a link to AWS Cloud 9 pricing below.

In general, if you are building a static web site then you probably won't have to pay for any extra resources. Otherwise, if you are building a dynamic website with a postgresql DB then the price for the extra resources (increased RAM and disk space) could be between $29.00 and $49.00 per month.

Update ....I was able to resolve the 403 Forbidden error when rendering the admin sign-up view by starting the rails project over again from scratch and installing/updating web-packer after running bundle install for the new rails project. And then afterwards I installed devise and created the devise models, views and controllers for the admins and users.

The lesson learned was to install and update web-packer before installing devise and generating the devise models, views and controllers for the respective user classes.

Is there a way to resolve 403 Forbidden error when rendering a sign-up view for admins? This issue does not happen to the user sign-up views.

I am using Rails, Ruby 2.7.1 and Devise 4.7.3.

I have followed the information in this link to set-up multiple devise models:

I've also checked the 'Admin' directory and view file permissions and they match the same permissions that are used for the 'User' folder and view files.

So I don't understand why a '403 Forbidden' error is returned when trying to render the devise views for the Admins.

Any guidance to help resolve this error would be greatly appreciated.

server LOG messages

render user sign-up view - - [16/Mar/2021:13:34:32 UTC] "GET /users/sign_up HTTP/1.1" 200 26684 -> /users/sign_up

render admin sign-up view

Started GET "/admins/sign_up" for at 2021-03-16 13:45:06 +0000 - - [16/Mar/2021:13:45:06 UTC] "GET /admins/sign_up HTTP/1.1" 403 10 -> /admins/sign_up


#devise_for :admins
devise_for :admins, path: 'admins', controllers: { sessions: "admins/sessions", registrations: 'admins/registrations', passwords: 'admins/passwords', unlocks: 'admins/unlocks', confirmations: 'admins/confirmations'}
authenticated :admin do
root 'pages#index', as: :authenticated_admin_root
get 'adminpages/adminhome'

#devise_for :users
devise_for :users, path: 'users', controllers: { sessions: "users/sessions", registrations: 'users/registrations', passwords: 'users/passwords', unlocks: 'users/unlocks', confirmations: 'users/confirmations'}
authenticated :user do
root 'pages#index', as: :authenticated_user_root
get 'userpages/userhome'

# Rails routes:
Prefix Verb URI Pattern Controller#Action
cancel_admin_registration GET /admins/cancel(.:format) admins/registrations#cancel
new_admin_registration GET /admins/sign_up(.:format) admins/registrations#new
edit_admin_registration GET /admins/edit(.:format) admins/registrations#edit
admin_registration PATCH /admins(.:format) admins/registrations#update
PUT /admins(.:format) admins/registrations#update
DELETE /admins(.:format) admins/registrations#destroy
POST /admins(.:format) admins/registrations#create

cancel_user_registration GET /users/cancel(.:format) users/registrations#cancel
new_user_registration GET /users/sign_up(.:format) users/registrations#new
edit_user_registration GET /users/edit(.:format) users/registrations#edit
user_registration PATCH /users(.:format) users/registrations#update
PUT /users(.:format) users/registrations#update
DELETE /users(.:format) users/registrations#destroy
POST /users(.:format) users/registrations#create

navbar links:

<li class="nav-item"><%= link_to 'User Sign up', new_user_registration_path, :class => "nav-link" %></li>
<li class="nav-item"><%= link_to 'Admin Sign up', new_admin_registration_path, :class => "nav-link" %></li>

Posted in Rails credentials returning nil

In Rails, I had to use the following syntax to echo the values in the rails console: Rails.application.credentials.dig(Rails.env.to_sym, :stripe, :stripe_public_key)

Hi Chris, this is a very good video. I have completed a few rails apps for my clients that utilize multiple foreign languages using a process that is very similar to the one in your video. For these projects I also had to update the Bootstrap and Simple form YML files to include the appropriate translations for the available languages that were defined for the respective apps.

Thank you very much for making this video! Your video resolved all of the issues that I was running into when I was trying install Jumpstart from the GitLab repo

I found the solution to the problem I was running into for the Flash alert/notification messages not displaying with the correct styling for the 'Log In' and 'Log Out' views. The issue was resolved after I added the alert helper rb file described in the link below.


The flash alert/notification for the 'Log In' and 'Log Out' views are not displayed on the screen when a user logs in or out of the Rails application.

I am not getting any errrors or warnings in my log file that I can share.

I can confirm that the Bootstrap CSS file contains the styling used for the flash alert messages.

I am using the Ruby, Rails and gem versions below:
Ruby 2.6.5
Bootstrap 4.4.1
Simple-form 5.0.2
Devise 4.7.1

After installing Simple-form I ran code below from the command line:

 rails generate simple_form:install –bootstrap

And after installing Devise I ran the code below from the command line:

  rails generate devise:install
  rails generate devise User
  rails generate devise:views

I have also added the code below to my application.html.erb:

<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>

And using the above code a flash alert/notification is only displayed for errors that are encountered on the ‘Sign up’ form.

I tried searching for a solution on the internet and I found a partial solution below that will display the flash message without the correct CSS styling for the 'Log In' and 'Log Out' views . The code below was added to my application.html.erb:

<% flash.each do |name, msg| %> 
    <div class='container-fluid' style='padding-right: 35px; padding-left: 35px'>
            <%= content_tag :div, msg, :id => "flash_#{name}",  :class => "alert alert-#{name}" %> 
<% end %> 

Can anyone help me resolve the problem that I am running into with the Flash alert/notification messages not displaying with the correct styling for the 'Log In' and 'Log Out' views?

Hi Chris,
thank you very much for providing the solution to the routing error I was running into.

I am running into a routing error for a get action when I try to render an html erb view from the '../views/pages' folder via a navbar link.

I have reviewed the routes.rb file and the output from "rake routes" to verify that route for the 'about' view has been defined in the routes file.

So I do not understand why the routing error is happening when the path is defined in the route file correctly.

I have listed below the url helper that I am using in the navbar, my routes.rb file and the output from rake routes.

Does anyone have any suggestions to resolve the routing error that I am encountering?

url helper defined in _nav.html.erb:

<li class="nav-item">
  <a class="nav-link" href="pages_about_path">About</a>


Rails.application.routes.draw do
  root to: 'pages#index'  
  get 'pages/about', to: 'pages#about'  
  # For details on the DSL available within this file, see

rake routes output:

Prefix Verb URI Pattern Controller#Action
root GET / pages#index

pages_about GET /pages/about(.:format) pages#about

Posted in Subscriptions with Stripe Discussion

Would it be possible to add a record to the CHARGE DB for the initial subscription via the subscriptions controller?

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.