/r/rubyonrails

Photograph via snooOG

Everything RoR!

Ruby on Rails, often simply Rails, is an open source web application framework which runs on the Ruby programming language.

A subreddit for discussion and news about Ruby on Rails development


Also check out;

/r/learnrubyonrails
/r/rails
/r/programming
/r/computerscience

/r/rubyonrails

21,835 Subscribers

8

I'm open for volunteering works

Do you guys know any job boards where I can find companies/non-profit orgs that need volunteers? I'm a Ruby on Rails developer from the Philippines with 2 years of experience. I'd like to offer volunteer works while I don't have permanent job. Any suggestion will be highly appreciated. Thanks!

2 Comments
2024/12/14
13:40 UTC

0

[HIRING] We are looking for ruby on rails developer for fintech start up If you have experience in ruby on rails feel free to ping

NOTE: We are looking for developers onsite in mumbai, india

4 Comments
2024/12/14
10:11 UTC

5

Does anyone have a guide on serving static assets from a CDN when deploying with Kamal?

I’ve successfully deployed an app with Kamal and hosted my assets on a CDN (Cloudflare R2), but I mostly figured it out through experimentation. It’s not entirely reliable, though, because occasionally, when I deploy the app, some assets break (resulting in 404 errors), forcing me to revert the changes. I’m looking for a proper tutorial to follow to set it up correctly.

2 Comments
2024/12/12
14:19 UTC

0

Seeking for Ruby on Rails Developer Job Role

Hi, Everyone!

I’m currently seeking my next big challenge as a Software Developer, Ruby on Rails Developer, or JavaScript Developer.

Here’s a little about me:

💻 Experienced Software Developer with a proven track record at Witmates Technologies, a prestigious CMMI Level 5 & ISO Certified company.

📍 Open to opportunities in Indore, Bengaluru, and Pune, but I’m always ready for exciting remote projects!

🌟 Passionate about crafting clean, scalable code and building impactful digital solutions.

If you come across any opportunities that align with my skills or would like to collaborate, feel free to drop me a message or comment below.

I’d also love to connect with like-minded professionals!

#OpenToWork #RubyOnRails #JavaScript #SoftwareDeveloper

2 Comments
2024/12/10
21:27 UTC

6

Kamal Tutorial

Hi, allow me to share with everyone the Kamal Tutorial series:
Kamal Tutorial playlist: https://www.youtube.com/watch?v=l3x0HbjwbdY&list=PLPTwwdfm_Y0TmMN-rGjpcw-KuV84S6kbo&ab_channel=Th%C3%A0nh%C4%90%E1%BB%97

Contents of Kamal Video Series:

Lesson 1:
When the system has few users, a single server can handle all requests.
We will configure and deploy everything necessary onto one server using Kamal.

  • 1 server for Rails + jobs/workers with a solid queue
  • 1 server for the database

Lesson 2:
After deploying everything to a single server and accumulating a certain amount of data, we want to add an accessory to back up the data and upload it to AWS S3.

Lesson 3:
After running the application for some time, as the number of users grows, we need to ensure the web application operates without impacting database performance. At this point, we separate the Rails server and the database server into two distinct servers:

  • 1 server for Rails + jobs/workers
  • 1 server for the database

Lesson 4:
Over time, we may encounter a growing number of jobs/workers that need to be processed in the background. To ensure the jobs/workers server doesn't affect the performance of the Rails web app server, we separate them into distinct servers:

  • 1 server for Rails
  • 1 server for jobs/workers
  • 1 server for the database

Lesson 5:
Thanks to successful marketing efforts, our system now has a significantly larger user base. At this stage, we need to scale our web app servers.
Using Kamal, we deploy the Rails application across multiple servers:

  • 3 servers for Rails + a load balancer
  • 1 server for jobs/workers
  • 1 server for the database

Lesson 6:
Add the lsof package and check whether the jemalloc and YJIT libraries are enabled to optimize performance and memory usage.

Lesson 7:
In the event of an issue after deployment, we need to roll back the web app. Kamal will be used to perform the rollback.

We kickstart our comprehensive series on deploying a Ruby on Rails 8 application to a Hetzner cloud server using Kamal. From setting up your server to deploying your Rails app, we guide you step by step. Perfect for developers looking to streamline their deployment process! This tutorial is perfect for developers looking to simplify their Rails app deployment process and apply the knowledge across various cloud platforms: EC2, Compute Engine, Azure Virtual Machines (VMs), Hetzner,...

0 Comments
2024/12/05
15:36 UTC

9

We are going to need a HTML to PDF generator and our current method crashes pretty frequently...

Our product generates tax document for many clients. And some of those clients are restaurant owners. So they have 5000-6000 pages of sales/purchase register. Our previous clients were generating far less number of pages so our solution worked fine for all these years. We take the data from active record and generate the html with the view slim file by render_to_string, then we send that to Grover which by help of Sidekiq generates PDF using puppeteer...

But our free Sidekiq version only supports one thread and if it is working flawlessly (which is not very common) it takes about 1 hour to product anything over 600 pages.

We badly need a solution that is fast and works every time. Any help is appreciated.

19 Comments
2024/12/04
04:28 UTC

2

Matomo as analytics?

I need a self hosted analytics solution which is gdpr complient without a needed cookie banner. I came across matomo and it sounds pretty nice, but the available gem wasnt maintained in years and i cant find anybody using it with rails.

Should i go with matomo anyway or which solution do you prefer?

2 Comments
2024/11/19
19:48 UTC

2

How do you handle sample data during onboarding?

I'm working on a B2B SaaS application. As part of the onboarding experience for users, I create a bunch of sample data records that give them a head start of how to use the application. So instead of seeing a 'no records found' screen when they first sign in, they see a bunch of sample data they can interact with.

The sample data is currently created in ActiveRecord callbacks after the account is created. From a data point of view, they are exactly the same as if the user were to create them themselves. They are just records in the database linked to the user record. But this has some issues:

- I want to be able to update the sample data, but right now we don't keep track of which record were created from sample data. I can do it for new users, but not for existing users.

- Users can edit the sample data records, so even if we did keep track of them, we'd need to keep that in mind and only change the onces they did not edit. But I want to be able to edit them to highlight new features.

It seems like a better approach would be to have the sample data not be an actual database record, just to look like one, and whenever the user does any actions on them, then to create a record in the database that's tied to the user account. We could even show both, as the user usually changes the record title whenever they make edits. Has anyone done anything like this?

3 Comments
2024/11/19
07:50 UTC

11

Guide on Ruby on Rails Forms: Nested Attributes // Multiple Nested Models with StimulusJS

0 Comments
2024/11/18
10:51 UTC

4

With Rails 8 and authentication being included, are they going to add that to the document tutorial?

Everything I find it from

6 Comments
2024/11/14
04:18 UTC

4

Want to Integrate Azure SDK in Ruby? Here’s the Guide You Didn’t Know You Needed! 🔥

Hey everyone! We’ve just released a step-by-step guide on connecting Azure SDK with Ruby, even though Ruby isn’t officially supported. This easy workaround helps you connect Ruby projects with Azure seamlessly. Dive in and share your feedback with us: link🚀

0 Comments
2024/11/13
14:41 UTC

19

Should this sub be merged with r/rails?

This topic has been up before – but it's never too late to fix someting broken.

On Reddit we have one active rails subreddit and one semi-active rails subreddit:

  1. This one ( r/rubyonrails ) - created may 19th 2008 - with 21k members - placing it in the top 5% of subreddits according to reddit stats. It has 5 posts in the last week, top one with 9 points and 4 comments
  2. And r/rails - created march 18th 2008 - with 65k members, placing it in the top 2% of subreddits, according to reddit stats. It has 60+ posts in the last week, top one with 217 points and 129 comments.

Neither top post was discussed in the other subreddit - so people who aren't subbed to r/rubyonrails didn't see the post from u/Longjumping-Spend on his ecosystem page, and people who aren't subbed to r/rails didn't see the "Hotwire is boring" post.

I don't know why the split happened in 2008 (it might have been chance, it might have been disagreements between mod teams) – but isn't it about time we combined forces?

r/rails is obviously the larger subreddit, and should probably be the default - so combining forces would mean de-facto closing down this subreddit and pointing it to the other one.

View Poll

6 Comments
2024/11/05
08:35 UTC

5

Why my local rails version not same as gem version?

My goal it to install Rails 6 on my machine.

I use the following command to install rails 6,

gem install rails -v 6.1.7.8

gem list rails

*** LOCAL GEMS ***

rails (6.1.7.8)

But when I check local rails version it shows

rails -v
Rails 7.1.5

which rails
/Users/user/.asdf/shims/rails

My question is, why there's rails 7 on my machine? I didn't use asdf to install any rails, how do I remove that and use my gem rails?

My steps of installing rails is from gorails

2 Comments
2024/11/04
16:17 UTC

12

An ecosystem page for Ruby on Rails

Hi! I'm making a resource to help explore different software ecosystems, and I made a directory for Ruby on Rails here: https://ecosystems.gitwallet.co/ecosystems/rails/

You can think of this as a different take on Github Explore (although we're getting repos from Gitlab as well), but also featuring some of the people in the community too. I think we need better tools for exploring open source in this way, and we're experimenting with it.

We also made a different take on the Github repo page to make it a bit more readable, see related repos, and a few more things. Here's an example for Cancancan:

https://ecosystems.gitwallet.co/ecosystems/rails/projects/cancancan

Anyways would love some feedback from other Rails folks here. I've been a Rails dev since Rails 3, and love all the new stuff coming out.

4 Comments
2024/10/31
02:44 UTC

4

Reviving an old app?

I recently was handed a project that hasn't been maintained in years. Everything is horribly out of date. What's the best process for reviving it?

Some details:

  • Gemfile
    • Ruby '2.5.7'
    • gem 'rails', '4.2.11.1'
    • gem 'sprockets', '3.7.2'
    • gem 'rack'
    • gem 'puma'
    • gem 'pg', '~> 0.20'
  • They had a uat environment deployed on the same stack, but it's crashed and won't restart
  • Prod and UAT were deployed on Heroku 18 stack

I'm thinking: set up a linux distro & try to install these older versions of everything (I can't seem to install 2.5.7 via rvm on osx 14.7? Would be nice if I could just do that instead?)

Thoughts?

7 Comments
2024/10/30
23:18 UTC

0

🚀 CI Tools Showdown: What’s Your Go-To?

Hey Devs! 🖥️ I’m curious about your favorite CI tools and why you chose them. Between Semaphore, CircleCI, and GitHub Actions, which one do you swear by, and what made it the best fit for you? 🤔

For those who’ve been through the decision-making process—who usually calls the shots? Is it devs, team leads, or higher-ups? Would love to hear if the choice has impacted your workflow, productivity, or even morale! Let’s chat pros and cons! 💬

2 Comments
2024/10/29
18:40 UTC

0

I've created a SaaS template

Hey, Sergio here.

I've created this template for Ruby on Rails developers who want to launch their products faster.

2 Comments
2024/10/27
07:21 UTC

1

Interview next week, Any advice.

I have 1st stage video call scheduled for next week. With senior developers for ROR Developer(with passion to learn flutter as mentioned on JD) for just half an hour. What can I expect of this 0.5hr call and what should I prepare?

(My BG is RoR exp of 1.5 yrs as full stack developer in India but I haven't been in touch for more than a year now, as I just finished my master's in DS in UK.)

1 Comment
2024/10/25
23:22 UTC

2

Help with deploying to heroku

So im trying to deploy my rails app basically this is what im using with rails 7.0.6 and ruby 3.1.2:

{
  "name": "app",
  "private": "true",
  "dependencies": {
    "@hotwired/stimulus": "^3.2.1",
    "@hotwired/turbo-rails": "^7.3.0",
    "@rails/actioncable": "^7.0.6",
    "autoprefixer": "^10.4.14",
    "esbuild": "^0.18.16",
    "flowbite": "^1.8.1",
    "postcss": "^8.4.27",
    "stimulus-notification": "^2.2.0",
    "tailwindcss": "^3.3.3"
  },
  "scripts": {
    "build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets",
    "build:css": "tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css --minify"
  }
}

this is my procfile:

release: bundle exec rails db:migrate && bundle exec rails assets:precompile
web: bundle exec rails server -b  -p $PORT -e production
sidekiq: bundle exec sidekiq -e production
mqtt_listener: bundle exec rails runner lib/background_mqtt_listener.rb0.0.0.0

I added redis for my sidekiq and postgres for the database on the resources tab of heroku.

right now im getting this error:

2024-10-25T15:41:51.671226+00:00 heroku[web.1]: Starting process with command `bin/rails server -p ${PORT:-5000} -e production`

2024-10-25T15:41:53.866640+00:00 app[web.1]: => Booting Puma

2024-10-25T15:41:53.866667+00:00 app[web.1]: => Rails 7.0.8 application starting in production 

2024-10-25T15:41:53.866667+00:00 app[web.1]: => Run `bin/rails server --help` for more startup options

2024-10-25T15:42:06.000000+00:00 app[heroku-redis]: source=REDIS addon=redis-trapezoidal-49953 sample#active-connections=1 sample#max-connections=18 sample#connection-percentage-used=0.05556 sample#load-avg-1m=14.79 sample#load-avg-5m=18.55 sample#load-avg-15m=18.76 sample#read-iops=0 sample#write-iops=0.25 sample#max-iops=3000 sample#iops-percentage-used=0.00008 sample#memory-total=16070672kB sample#memory-free=6740524kB sample#memory-percentage-used=0.58057 sample#memory-cached=5602796kB sample#memory-redis=516528bytes sample#hit-rate=1 sample#evicted-keys=0

2024-10-25T15:44:51.914826+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 180 seconds of launch

2024-10-25T15:44:51.927279+00:00 heroku[web.1]: Stopping process with SIGKILL

2024-10-25T15:44:51.984252+00:00 heroku[web.1]: Process exited with status 137

2024-10-25T15:44:52.005138+00:00 heroku[web.1]: State changed from starting to crashed

things ive tried to solve the issue but did not change anything:

  • made sure there is a db connection
  • made sure the migrations are done
  • made sure the port variable is set to PORT so that heroku sets it
  • tried without mqtt and sidekiq
  • upped the boot time to 180 sec in case it was slow because of that
  • added peload_app! to puma settings
  • precompiling assets myself and uploading them to the repository while also disabling precompile on heroku

If anyone has any other solutions that I can try I would really appreciate it, thank you in advance.

13 Comments
2024/10/25
16:03 UTC

1

Need Short-Term Hosting for Ruby on Rails 3.0.3 (Legacy App)

I'm looking for a recommendation for a temporary hosting provider that supports older versions of Ruby (1.9.2p136) and Rails (3.0.3). The current server hosting our legacy app is being shut down in a week, and we need to move it quickly while we finish rebuilding the site on WordPress.

It’s a directory-based site, so it’s not massive, but it’s critical that we keep it live during the transition for about 1-2 months.

What we’re looking for:

  • Short-term VPS hosting that allows us to install and run older Ruby and Rails versions.
  • Root access so we can configure the environment as needed.
  • Affordable pricing for this temporary solution.
  • Something stable and secure for the immediate short-term.

If anyone has experience with this kind of setup or can recommend a reliable hosting provider, your advice would be hugely appreciated! We need to make this move ASAP.

Thanks for your help!

8 Comments
2024/10/24
20:09 UTC

2

Rails Application Stuck on Default Welcome Page Despite Creating Custom Controller and View

Description:
I'm building a Rails application and seem to be stuck on the default Rails welcome page. Despite creating a custom controller (WelcomeController) and view (index.html.erb), my application keeps showing the Rails default welcome page.

I've tried a few things, but I can't seem to figure out why the routing isn't working or why my custom controller/view isn't being rendered.

Steps I've Taken:

  1. Created WelcomeController:
    • Here's the content of app/controllers/welcome_controller.rb:
    • class WelcomeController < ApplicationController
    • def index
    • end
    • end
  2. Created the corresponding view:
    • The file path is: app/views/welcome/index.html.erb
    • The content of the view file is:
    • <h1>Welcome to My Rails App!</h1>
    • <p>This is the homepage.</p>
  3. Updated routes:
    • Here's my config/routes.rb:
    • Rails.application.routes.draw do
    • root 'welcome#index'
    • end
  4. Other adjustments:
    • I've tried restarting the server multiple times (rails server).
    • I checked the routing with rails routes, and it shows the correct route.
    • I'm still seeing the default Rails welcome page, and in the logs, it seems to be rendering from Rails::WelcomeController#index rather than my custom controller.

What I Need Help With:

  • Why is the Rails default welcome page still showing, even though I've created my own controller and set up the routing properly?
  • How do I ensure that Rails uses my WelcomeController and index.html.erb view instead of the default welcome page?

Logs (Partial):

Here’s what my server logs show when I access the root URL (/):

Processing by Rails::WelcomeController#index as HTML
  Rendering C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/railties-7.2.1.1/lib/rails/templates/rails/welcome/index.html.erb
  Rendered C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/railties-7.2.1.1/lib/rails/templates/rails/welcome/index.html.erb (Duration: 1.0ms | GC: 0.0ms)
Completed 200 OK in 15ms (Views: 4.4ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)

Additional Information:

  • I’ve already checked that the welcome_controller.rb file exists under app/controllers and the index.html.erb file exists in app/views/welcome.
  • I have tried running rails routes, and the route appears to be correct:
  • root GET / welcome#index

Any suggestions on what might be wrong or what I should check next?

Thank You:

Thanks in advance for your help! I've been stuck on this for a while and would appreciate any insights.

8 Comments
2024/10/24
09:21 UTC

4

How do you test your ideas when launching a side business in Ruby?

Hey everyone, A little while ago, I was brainstorming business ideas and found myself spending way too much time setting up basic infrastructure. So, I decided to build a small Ruby on Rails boilerplate with a customizable landing page and Stripe already integrated, just to make things easier for future projects. Would you be interested? Good luck with your projects!

5 Comments
2024/10/22
09:10 UTC

Back To Top