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...
...piece, but it should be tidy and clear. If you have generated styles from Rails scaffolding, delete them all. They don't look nice and we do not use them...
...remove it and build your own styles from scratch. Tip Up until version 6, Rails understands Sass out of the box. No need to install additional software. Your MovieDB uses...
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...
...stack of tools. Start this card by skimming over the linked resource. Discussion Growing Rails applications in practice Read the following chapters from our book Growing Rails Applications in Practice...
...On following fashions Surviving the upgrade pace of Rails Owning your stack Discuss each chapter with your mentor. The Swinging Pendulum The XKCD about the sandboxing cycle is quite on...
...BEM, block-by-block. Read Read the chapter "Taming Stylesheets" from our book Growing Rails Applications in Practice (in our library). Talk with a colleague about the reasons for the...
...a good BEM structure in the DOM tree of these websites: https://makandra.de/ https://railslts.com/ https://www.aitiraum.de/ Practice: Cards In a new project, try to layout the style of...
...for every little thing. Jasmine is a purely client-side tool. It cannot ask Rails to render a view or access the database. Any HTTP calls must be mocked.
Tip Create the required DOM directly from your Jasmine spec. You cannot ask Rails to render a view. You can use Element#dispatchEvent() to emit events on a DOM...
...you're not familiar with the pattern, read or re-read "New rules for Rails" from Growing Rails Applications in Practice (in our library) How to navigate between indexes, show...
...feature-binaries commit id: "docs" commit id: "add binaries" type: HIGHLIGHT commit id: "init rails" You are now asked to split up the add binaries commit to one commit per...
...id: "echo binary" type: HIGHLIGHT commit id: "curl binary" type: HIGHLIGHT commit id: "init rails" Exercise 3: Rebase onto a diverged feature branch with merge conflicts %%{init: { 'gitGraph': { 'mainBranchName': 'master...
Learn about Method#source_location. Look up a method like save! in the Rails API docs. The result should have a link to the source location on GitHub.
...monkey patches. When you add or change an initializer you need to restart your Rails server or console for the changes to be picked up. Only changes in app are...
Read (or re-read) the following chapters from our book Growing Rails Applications in Practice (it’s in our library): New rules for Rails Beautiful controllers Relearning ActiveRecord
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.
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...
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...
...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...
Best results in other decks
...1M downloads), and geordi (> 200k downloads) Developing a Ruby gem is different from developing Rails applications, with the biggest difference: there is no Rails. This means: no defined structure (neither...
...to require all files yourself no active_support niceties Also, their scopes differ. A Rails application usually combines many libraries with custom code. It runs on a given version of...
...ActiveRecord scope. Depending on what you want to achieve, this is quite easy with Rails 7, and a bit more complicated with Rails 6 and below, or when the inverse...
...to get all users which are not part of User.admins, say: User.where.not(id: User.admins) Rails will generate a query like the following. SELECT * FROM users WHERE id NOT IN (SELECT...