/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,752 Subscribers

16

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

4 Comments
2024/11/05
08:35 UTC

4

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

1 Comment
2024/11/04
16:17 UTC

9

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

6

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

2

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:23 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.)

0 Comments
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

0

AI could kill your Rails app, even if you don't use it.

In 2022, software development is no longer what it used to be. There's a new player in the game: the almighty (or scary?) LLM. Many companies have been early adopters of LLMs. Some of them are profiting from it. Some of them are selling cars for $1. I am not here to judge.

Even if you haven't jumped on the LLM train yet, it may still affect your application.

With the rapid growth of LLM services, there's also a rapid growth in the number of bots that crawl the data to feed them. Some of them follow internet etiquette. Some of them don't. One example is ClaudeBot.

In one of our consulting jobs we were confronted with this problem. The application was dying once, or actually several times a day. Literally.

One of the reasons was that ClaudeBot was scanning the application's product catalogue page, which happened to be slow. An obvious solution is to block ClaudeBot in robots.txt. But is that all?

If you think about this situation, ClaudeBot, besides its greediness and fetching the data in an unpleasant way, generated a kind of stress test. And the application failed.

Blocking it masked the problem. But during possible peaks (hello Black Friday), the same situation can occur. So what do you do?

Well, improve the performance of the site. Slow performance is often caused by N+1 or by eagerly loading data that you don't even show.

TLDR:

  • bots/crawlers may become majority of your traffic
  • you have to decide whether you want to be part of this game or opt out via robots.txt
  • take care of entry pages and product catalogs performances
1 Comment
2024/10/22
13:22 UTC

2

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

1

The state of security in Rails 8 - Rails World 2024

0 Comments
2024/10/16
11:38 UTC

1

Rails on AI: Empowering the Individual - Obie Fernandez at Rails World 2024

0 Comments
2024/10/16
11:34 UTC

2

How to deploy web applications with Kamal

0 Comments
2024/10/16
11:32 UTC

10

Prepare to tack: Steering Rails apps out of technical debt - Rails World 2024

0 Comments
2024/10/16
01:50 UTC

0

Benchmarking Crunchy Data for latency

At Rails World 2024, David Heinemeier Hansson introduced Kamal 2 in his keynote, and many are excited to try it. However, some prefer a managed database for peace of mind.

That's where Crunchy Data comes in. They provide managed Postgres service.

During an internal discussion, one of our engineers raised a crucial question: What impact would latency have on performance with the server in a different data center?

We decided to find out by running benchmarks. Check out our findings here: https://www.bigbinary.com/blog/crunchy-bridge-vs-digital-ocean

1 Comment
2024/10/15
11:24 UTC

0

Learn ROR 8.0

I'm just starting to build an app and want to start with Rails 8.0 as I'll be working on it for 6months+ so I imagine that would be the right choice?

Anyone seen a good guide/tutorial on getting started with 8 - I have only found ones for 7.2?

4 Comments
2024/10/15
08:25 UTC

0

full stack developer

Elevate Your Career Journey with Narra Labs!

Are you a developer passionate about crafting awesome web apps with Ruby on Rails? Narra Labs wants YOU! We’re seeking a talented Full-Stack Ruby on Rails Developer to join our team. If you enjoy coding we want to help you stand out.Learn, grow and have fun while doing it!

Salary $1000-4000 USD Per Month

Responsibilities

  • Collaborate with teams to launch new features

  • Ensure app performance, quality, and responsiveness

  • Identify and fix bugs

  • Maintain code quality and automation

  • Help manage cloud infrastructure

Qualifications

  • Proven experience as a Full-Stack Developer or similar role

  • Familiarity with AWS services and infrastructure management

  • Solid knowledge of database systems

  • Strong problem-solving skills and attention to detail

  • Excellent communication and teamwork abilities

  • 1/3 years of experience Ruby on Rails (or more if you’re a superstar!)

Perks & Benefits

-Hybrid work model: Only 3 days in the office per week

-Food budget

-Transportation budgetReimbursable HMO

-Yearly bonus

  • Innovative and impactful projects

-Professional development and growth opportunities

-A collaborative and inclusive company culture

How to Apply

Are you ready to bring your web development magic to Narra Labs? Send us your resume Email us at jess@narralabs.com with the subject line “Full-Stack Developer Application”.At Narra Labs, we believe in growing together and having fun along the way. We are an equal opportunity employer, and we celebrate diversity. We are committed to creating an inclusive environment for all employees.

Join us and let’s build something amazing together while having a great time

0 Comments
2024/10/15
07:55 UTC

6

Translating knowledge to ROR

Hey there , I have been a full stack engineer for sometime now , and recently introduced to a project that requires me to learn ROR. I previously used spring, .Net, React, and angular. And got quite good with building stuff with azure, postgrse , MySql, Reddis . I am looking for a path/article to read to translate my knowledge well, I was wondering what you guys suggest. Hopefully something as good as Odin project for react but for RoR, that would include all necessary things to learn in one place.

9 Comments
2024/10/15
07:35 UTC

9

Interfacing with external APIs: the facade pattern in Ruby

👋 Hey folks, I just wrote a post about the structural pattern called "facade" and how to use it in your Ruby on Rails applications.

If you’re not familiar with this structural pattern, it basically solves the questions of:

“How do I gather all the logic related to a third-party API”

and

“How do I bridge an external API interface with the core logic of my own application”

It’s a kinda walkthrough post, where I start from a controller bulging with code related to a 3rd-party API, and slowly building a facade from there.

Along the way, we’ll try to clear the confusion between facades, gateways and adapters. We'll also see that the literature has not reached a consensus on the whole "facades" versus "gateways" thing.

Anyway, no more spoilers: https://remimercier.com/facade-pattern/

Lemme know what you think.

0 Comments
2024/10/15
06:34 UTC

5

Running all services on one machine

I'm researching how I could move away from third party hosting/deployment services in favor of putting my applications on a single machine. My question is whether folks put all their services on one machine when they do this? (e.g. Redis, Sidekiq, Puma, etc...)

I know you can do this, but is this what's meant by today's discussions around moving away from PAAS solutions to single server / machine doing all of the work?

12 Comments
2024/10/14
14:20 UTC

Back To Top