...Best practices for writing code comments Read the following chapters from our book Growing Rails Application in Practice: Dealing with fat models Extracting service objects Discuss with your mentor what...

...Ruby projects. These projects use a large number of different versions for Ruby, Rails and many gems. To be able to switch between projects easily, we must control every dependency...

JavaScript files that can be loaded individually from your application layout. By default your Rails application has a single entrypoint application.js, which should import all other files.

...create only the records needed for the test. Learn Factories, not fixtures By default Rails uses global fixtures for its tests. This is a giant world of example data that...

...other gems in the past, but they all work in the same way. Watch Railscasts PRO #158 Factories not Fixtures (revised) for an introduction to factories in general and FactoryBot...

...README for the carrierwave gem Read about Common mistakes when storing file uploads with Rails Carrierwave: How to attach files in tests Carrierwave: Built-in RSpec matchers CarrierWave: Processing images...

Understand that each call of a cron job will boot up your Rails application and produce 100% load on a CPU during booting. Talk to your mentor what...

...notably, it allows you to represent data in a very readable manner. For example, Rails offers a compact DSL to define new routes. A big drawback however is that your...

makandra Curriculum

Watch Solving bizarre authorization requirements with Rails Read the Consul README Read the assignable_values README Understand how Consul and assignable_values can be used to implement arbitrary authorization...

Adopting legacy Rails apps Talk to your mentor about how we're approaching applications that are either old or abandoned by a different team earlier: Add E2E tests for the...

makandra Curriculum

...to understand what middlewares in Rack are good for. Rack Start with these articles: Rails on Rack Introduction to Rack Middleware Short Screencast to a sample Middleware

...answer the following questions: What is Rack? How does Rack relate to Ruby on Rails? What is Rack middleware? What are some advantages of implementing functionality as a middleware as...

makandra Curriculum

Why is it often fine to memoize instance methods? Resources Speeding up Rails with Memoization 4 Simple Memoization Patterns in Ruby (And One Gem)

website_sizer = WebsiteSizer.new website_sizer.size_of('https://makandra.com') # => 27448 website_sizer.size_of('https://railslts.com') # => 2145364 You can use any library to perform the actual HTTP request. The class should...

The asset pipeline is one of Rails' two mechanisms how stylesheets, javascripts and images from your /assets folder are processed and delivered to the browser. Rails has a second pipeline...

...webpacker, which we will cover later. Learn Read Everything You Should Know About the Rails Asset Pipeline Read How to make your application assets cachable in Rails Read Managing vendor...

...we're using building some of our sites using static site generators instead of Rails. You should talk about: Ease of development Security issues and maintenance costs Read through the...

What can't it do? What parts do you know from Rails? Practice Checkout the repo for the makandra blog Start the preview server Make some changes...

...often need to move data between the client (HTML, Javascript) and the server (Ruby, Rails). Step 1: Moving HTML snippets Add a find-as-you-type search to MovieDB. Above...

Rails ships with two separate build pipelines: Sprockets ("asset pipeline") and Webpacker. Webpacker has many more moving parts, but allows us to use ES6 modules and npm packages (through Yarn...

Best results in other decks

...Rails has a method ActiveRecord::Relation#merge that can merge ActiveRecord scopes. However, its behavior has never been clear, and in Rails 7 it still discards conditions on the same...

Every Rails response has a default ETag header. In theory this would enable caching for multiple requests to the same resource. Unfortunately the default ETags produced by Rails are effectively...

...random, meaning they can never match a future request. Understanding ETags When your Rails app responds with ETag headers, future requests to the same URL can be answered with an...

Search in all decks