Tutorials

Simple Repository Pattern for Ruby on Rails - DEV Community
In the famous book "Patterns of Enterprise Application Architecture", Martin Fowler define a repository with the following phraseA repository performs the tasks of an intermediary between the domain model layer and data mapping.I'm a visual person...

Creating A Private Ruby Gem for Ruby on Rails 7 - YouTube
Ever wondered how to create a gem for your Ruby on Rails projects? Well here you go, an entire tutorial dedicated to creating a private Ruby gem!Checkout my course(s) at: https://learn.deanin.comSource:https://github.com/Deanout/deep_freez...Join ...

Using GIVEN-WHEN-THEN on RSpec test classes - DEV Community
Using Given-When-Then in RSpecRSpec provides a way to use Given-When-Then in test classes by using aliases. Aliases are a way to define new names for existing RSpec methods. By using aliases, developers can write tests that use Given-When-Then syn...

Handling Decimal Precision in Rails - DEV Community
Ruby on Rails allows us to specify how precise we want decimals to be by defining precision and scale in database migrations. Rails also provides a way of adding front-end validation to forms that accept decimal values. I’ll be using an expense mo...





What to do when you need a button_to within a form in Rails
Imagine that you have a form to update a record (let’s say a product record) and inside the form, you are showing a list of images, and each image needs a button to remove it. You tried to use button_to but it doesn’t work because in html you can.

Are you absolutely sure your `has_one` association really has one association?
Learn about an unexpected limitation with this API and how to combat it universally.The Rails has_one API has an unexpected limitation: It does not prevent multiple records from being associated to the parent record.Take this simple example straig...