...database (ActiveRecord) What is a model? How are records retrieved and saved? Validations Migrations belongs_to, has_many, has_many :through Gain an understanding of the structure of a basic...

...in the database. Don't get confused by the use of text_field below. Beautiful controller pattern Refactor your MovieDB controllers to the pattern of our default controller implementation (without...

...scope like Post.active and use that. Learn Resources Active Record Query Interface Rails Database Best Practices ActiveRecord: Specifying conditions on an associated table Preload, Eagerload, Includes and Joins

...multiple but simple queries. This can be easier to understand and may even perform better. Exercises Cards query (makandra only) Ask someone for a dump of the staging target and...

...first get a general overview of the most popular solutions. To chose a single "best" of those, ask yourself questions such as: Is the library still maintained? When was the...

...level of our own standards. Does it have a ton of dependencies? Fewer is better, in this case. Sites like the Ruby Toolbox (only for gems) or npm compare may...

A common task in web applications is to add client-side JavaScript behavior to existing HTML elements. For instance, in Working with the DOM you built a movie counter...

✔️ Reliable invocation Using the HTML markup above should always result in the same behavior. Components are usually invoked when a particular CSS selector matches a new DOM element. This...

makandra Curriculum

...have one of the following workflow states: draft pending published declined A movie always begins as a draft and then transitions through the states as it's getting reviewed. This...

GRASP (object-oriented design) Single Responsibility Principle Tell, Don't Ask Best practices for writing code comments Read the following chapters from our book Growing Rails Application...

...has_many :items validates_presence_of :recipient_address, :number end class Invoice::Item < ApplicationRecord belongs_to :invoice belongs_to :product validates_numericality_of :units end class Product < ApplicationRecord validates_presence...

makandra Curriculum

Basic validations Read the Rails Guide on ActiveRecord Validations. You should have an overview which kinds of validations are built...

Ruby (business logic) HTML fragments (layouts and views) CSS/Sass/SCSS (styles) JavaScript (client-side behavior) Static media (images, fonts, videos) Except for the Ruby part, all these files are shipped...

...frees you from needing Webpack and Yarn. This is an experimental solution that could become the default in future Rails versions. It lacks any transpilation/transformation and bundling features. They reason...

makandra Curriculum

When your code does not behave as expected, you can use a debugger statement ("breakpoint") at any point in your code. This statement will open a REPL ("console") that you...

...the exact line in the code where your expectation does not match the actual behavior. Since we use open source for everything, we can always find that line. When you...

...and perform the following exercises. Tip If you've forked your MovieDB in the beginning, Jasmine is already integrated in your code base. Movie counter In Working with the DOM...

...DSL to define new routes. A big drawback however is that your code often becomes much harder to read. Another con of DSLs is that they tend to be so...

...email => 'foo@bar.de' } book.tobias_kraze # => { :phone => '67890', :email => 'bam@baz.de' } Now change Addressbook so each contact becomes their own Contact instance which responds to #phone and #email: book.henning_koch # => Contact<#....> book.henning_koch.phone...

Learn to treat files as an ActiveRecord attribute type, like :string or :integer Research Look at the README for...

...never influence each other On a similar note, we don't want tests to behave differently based on their execution order or parallelism. One core mechanism in this regard is...

...give your Movie model a #person attribute. Instead, use FactoryBot's transient attributes and before/after hooks to implement the factory above...

...a publicly available service) Understand that Safari and mobile Safari (for iOS) usually lag behind other browsers when it comes to feature support. "Transpilation" and "polyfills" are both techniques to...

...ES versions at the top. English MDN Web API Reference MDN is maybe the best reference for JavaScript, HTML and CSS features. Google my-feature mdn is a quick way...

...requestAnimationFrame can be used to reduce the number of repaints for animations. This might benefit your application performance. Read Don't throw exceptions from async functions What Color Is Your...

...helperFunction? What happens when you remove the await of init? What causes the new behavior? Now have a look at this sketched usage of asynchronous functions: const news = await fetchNews...

Resources Rails Guide: Internationalization API Guide to localizing a Rails application Locale-aware helpers in ActionView::Helpers::NumberHelper

makandra Curriculum

Understand how nested attributes appear in the params. See how the Rails form helpers encode the names of nested...

...E.g. although an "address book contact" and a "user" are both human beings, it's rarely practical to have them share a model or inheritance hierarchy. Try to model everything...

...CRUD for stands Everything related to viewing and editing weekly reports Read Project management best practices: Issues on how we write user stories. Note that in practice we would do...

makandra Curriculum

...addresses = AddressBook.new addresses.add Contact.new(first_name: 'Frederik', last_name: 'Foo') addresses.add Contact.new(first_name: 'Berta', last_name: 'Beispiel', phone: '556677') addresses.add Contact.new(first_name: 'Anna', last_name: 'Muster', street: 'Foo...

...returns contacts that match all of the words in any property: results = addresses.search('77 berta') results.size # => 1 results[0].first_name # => "Berta" Errors Change the AddressBook class so the #add...

makandra Curriculum

...diam nonumy eirmod tempor. | | | | | | | | | | | | | | | | | | | +------------+-----------------------------------------+ | Footer | +------------------------------------------------------+ Here are some more details how the layout should behave: Give each element (header, sidebar, etc.) a distinct background color to see where boxes start...

...do not use them. Pay attention to the margins in your styles. Elements that belong together logically (e.g. two navigation sections) should be closer to each other than elements that...

...access and manipulate the browser's DOM tree. Using JavaScript we can add interactive behavior to our interfaces that would not be possible through declarative rules in HTML and CSS...

makandra Curriculum

...built into RSpec. Play with some of these matchers in your MovieDB tests. The benefits of using better matchers Which of the following two lines is better? Why?

...is often to prefer isolated tests where possible, but share test setup when it becomes excessively complicated or expensive. If we share setup, it is best to do within a...

makandra Curriculum

...a feature look and feel). Frequent deploy gets changes to users faster. We sleep better, because we know stuff still works. Make sure no one removes a feature by accident...

...application changes. The more tests you already have, the less useful an additional test becomes ("Diminishing returns"). Tests sometimes fail even though the code is fine, especially when the test...

Exercise 1: Maps In MovieDB, add a new field “Principal filming location”. In a movie’s show view, geocode that...