RubyFlow The Ruby and Rails community linklog

×

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

You can use basic HTML markup (e.g. <a>) or Markdown.
Note that your post may be edited to suit the format of the site.

As you are not logged in, you will be
directed via GitHub to signup or sign in

Post Preview

Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.

  Today

PostgreSQL vs MySQL

There are many databases out there but most web applications developed using an open-source web framework use either PostgreSQL or MySQL. I’ve been asked by many clients over the years why they should use PostgreSQL over MySQL for their Ruby on Rails application. [more inside]

Validating the Content-Type of Active Storage Attachments

Full validation support for Active Storage attachments won’t be arriving until Rails 6. Until then you’ll need to write your own custom validators to add this missing functionality. Last time I showed you how to write an attachment presence validator. Next I’ll share a validator which can restrict the content-type of your attachments. Drop this bit of code and its accompanying RSpec matcher into your project to tide you over until the next Rails release. http://www.carlosramireziii.com/validating-the-content-type-of-active-storage-attachments.html

The nil value in Ruby

In this article we’re going to explore the following topics:

CanCanCan that scales

A simple explanation on how to use CanCanCan so that it scales with your application and does not impact your performances. The method is very simple and allows you to separate permissions for each model as Pundit does. [more inside]

Adding an Attachment Presence Validator to Active Storage

If you’re using Active Storage, you should know that it does not (yet) provide a way to validate the presence of an attachment. Unlike Paperclip or the other popular file upload gems, there’s no validates_attachment_presence method you can use. Luckily it’s pretty easy to roll this out ourselves. I’ll share the custom validator code that I use to add in the missing validator in this post: http://www.carlosramireziii.com/adding-an-attachment-validator-to-active-storage.html

Alias in Ruby

In the following article, we’re going to explore the following topics:

101: Advanced OOP Structure in Rails Practice

When thinking about more advanced OOP structure, one can sometimes ask – how to incorporate it into a Rails application? I will try to answer that question in this blog note, introducing some advanced OOP concept into a Rails application (without any architecture gems). [more inside]

Loading older posts