The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
The difference between dependent: :destroy and :delete_all
Adding “dependent: :destroy” to “has_many” is a good choice but can sometimes slow down your code. Switching to “dependent: :delete_all” will decrease the number of SQL queries by skipping validations and callbacks => https://www.youtube.com/watch?v=Gsw2gPbT1so
How environment check works in Ruby on Rails?
Did you ever wonder how Rails.production? work? => https://medium.com/rubycademy/how-environment-check-works-in-ruby-on-rails-4cfbd0434605
Understanding and Implementing OAuth2 in Ruby
Let me know if this feels familiar. Your users want to “login with GitHub,” so you install a gem, follow the setup instructions, then pray it never needs maintenance because you have no real idea how OAuth2 works. Let’s fix that. In this article, Diogo Souza shows us the fundamental concepts behind OAuth2 and how to implement them using Devise and Doorkeeper. https://www.honeybadger.io/blog/oauth2-ruby/
HexaPDF 0.12.0 released - Interactive forms support
I just released version 0.12.0 of HexaPDF, the versatile pure Ruby PDF creation and manipulation library, which brings support for interactive forms (AcroForm), including a CLI command for filling forms. See https://hexapdf.gettalong.org/news/2020/hexapdf-0-12-0-acroform.html
Why is Ruby on Rails a Language of Choice for Marketplace Development?
Our team has been building custom online marketplaces Ruby on Rails for several years now, and we truly think it’s a perfect match. We decided to briefly share the pros of using RoR for marketplace development. https://www.codica.com/blog/ruby-on-rails-marketplace-development/
Clear Case of Unclear Casing
Did you know that the following class definition is valid Ruby code? [more inside]
SJR todos
A fully ajaxified to-do app created with just 9 line of JavaScript thanks to Server-generated JavaScript Responses (SJR). [more inside]
Stimulus Search
Autocomplete example created with Stimulus JS, Ryby on Rails and HTML send over the wire. [more inside]
How to translate and localize your app with Rails internationalization (I18n)
Translating your app requires quite a few changes, but Rails has a lot of nice helpers to make the process a lot more manageable. Learn How to translate and localize your app with Rails internationalization (I18n)
2 ways to test Rails log messages with RSpec
If you don’t need to test log output on a regular basis, you may not find the solutions to be immediately obvious. Here are two ways (that I know of) to use RSpec to test messages sent to the Rails log.
Adding dynamic "getters" and "setters" to Ruby Objects.
Hi! This is my first post here. I created a blog post on creating a dynamic “attr_accessor” for a Ruby object! Figured I’d share with the class! https://blog.konnor.site/ruby/dynamic_getters_and_setters/
Ruby Refinements
Ruby Refinements. Ruby ecosystem allows us to modify or redefine existing class definitions. This is known as Monkey patching. https://www.botreetechnologies.com/blog/ruby-refinements
The very first draft of Rake
30 LOC that changed everything.. rubycademy.com/rake