Your objects are now inspected with pretty colors: Note that if your inspection becomes wider than your terminal, IRB will automatically break it across multiple lines, like you probably...

Debugging performance issues in your Rails app can be a tough challenge. To get more detailed insights consider using the...

...if .second-item could be rendered smaller without problems or has because you defined behavior for it. +---------+--------------------------------------+ | | - 1000 characters looooooooooooong | | +---------+--------------------------------------+ Try it on CodePen. There are two ways to fix...

...may just set overflow: hidden or maybe on .second-item and/or add some overflow behavior and you're done. In some cases, this might not be the solution because the...

This card existed before, but was outdated due to browser implementation changes. The information below is validated for the current...

...Cumulative Layout Shift score should be good' do # Cumulative Layout Shift seems to be better in tests than in reality, so # we use a lower value than the official "good...

...JavaScript every day, even when our backend code uses another language. While we've become quite adept with JavaScript at a basic level, I think many of us lack a...

Every function may use this, even if the function does not belong to the object. The default value of this is the global object (window in browsers...

github.com

For Sidekiq to be able to retry your jobs it has to be able to catch errors that occur while...

...may feel odd that the SQL statement says "UPDATE new_table". If your migration becomes too complex, you could put your logic into multiple reversible blocks (so they contain only...

end end A word of advice: Depending on your migration, you might be better off just defining 2 separate up and down methods instead of using change...

...Compliance Level; Asset file size could be reduced 2 New slider library has a better API Add capybara_lockstep 2 0 - 5 Reduce flaky integration tests

...would hand you UTC objects whose to_s(:db) may not convert properly. Legacy behavior in Rails 2.3 It's been briefly mentioned in the random list of ActiveSupport goodies...

You can chain multiple Capybara matchers on the page or any element: expect(page) .to have_content('Example Course')

...selectively for your current need of change. For a more detailed example on this behavior compared to the --worktree option you can have a look on the example within the...

...git restore with --source for the usage --staged compared to --worktree To get a better idea, why this behavior might be useful I will add an example for both commands...

relishapp.com

Sometimes you have a test expectation but actually want a better error message in case of a failure. Here is how to do that. Background Consider this test: expect(User.last...

Why is this cool? One might argue why we would want to have better error messages for test expectations when our tests are supposed to be always passing. Well...

...dumps can be created in multiple formats (see option -F in pg_dump documentation. Benefits of the custom format are more configurable restores (for e.g. you can omit setting permissions...

...speeds up restores). The custom dump is compressed by default too. To get a better idea check the parameters in the mentioned documentation. You can use a custom format dump...

blog.bigbinary.com

...joined tables or multiple queries? If you don't like the cleverness of this behavior, you can explicitely tell ActiveRecord how to preload associations with either JOINs or separate queries...

...includes usually works nicely, but Rails will apply some magic, as mentioned at the beginning of this card. This is subject to issues with polymorphic associations, too...

...form disables the submit button while working. // bad (how we used to do it) beforeEach(() => { this.form = setupMyForm() this.submitButton = findTheSubmitButton() }) it('disables the submit button while working', (done) => { expect(this.submitButton.disabled).toBe...

...our specs to simply return a Promise, so we could rewrite this as // slightly better it('disables the submit button while working', () => { expect(this.submitButton.disabled).toBe(false) let submitPromise = this.form.onSubmit()

...ms have passed!') }, function(reason) { console.error('Something went wrong: %o', reason) } ) This will become more important when we talk about async/await later. Exceptions are converted within then() handlers function fetchUsers...

} If f1() and f2() have an async API, our control flow must become async: function f1() { return Promise.resolve(2) } function f2(x) { return Promise.resolve(x * x) }

...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...

makandra dev
ruby-doc.org

...used for case-equality. In general it tells if the object on the right "belongs to" or "is a member of" the object on the left: String === "hello" # true

When an event listener on a DOM element throws an error, that error will be silenced and not interrupt your...

...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...

github.com

...that you can also make your matcher chainable, so a test can modifier its behavior. Using chaining you can write a matcher like this: expect(x).to be_a_multiple...

So you have a heading that is just barely wider than the container it should fit into, and it wraps...

makandra dev
gist.github.com

...byebug commands, it comes in handy with it's features for many use cases beyond that to make your life easier. For this cheatsheat I tried to structure the most...

...instance_methods(false). method -- The same as running .methods. Commands to change (or add) behavior at breakpoints display / undisplay [ ] - display or undisplays an expression at stopped breakpoint enable / disable [id...