- VIM MODE IN KINDLE FTFW.
- Mental health thing: “It’s 2017. We are in a knowledge economy. Our jobs require us to execute at peak mental performance. When an athlete is injured they sit on the bench and recover. Let’s get rid of the idea that somehow the brain is different.”
- When the database catches such a duplicate insertion, ActiveRecord::Base#save will raise an
ActiveRecord::StatementInvalidexception. You can either choose to let this error propagate (which will result in the default Rails exception page being shown), or you can catch it and restart the transaction (e.g. by telling the user that the title already exists, and asking them to re-enter the title). This technique is also known as optimistic concurrency control.
AR::Base.update_all: Updates all records, but constructs a single SQL update statement and sends it straight to the database.
AR::Base#saveto skip validations, then check after (this will allow swapping).
book.title = 'Hello'; book.color = 'red'.
- If you rescue the
AR::Rollback, then the database transaction will not rollback. What you do inside an
AR::Transactionwould be to raise any other error, and that will cause the transaction to fail. Reference
- Warning: one should not catch
ActiveRecord::StatementInvalidexceptions inside a transaction block.
ActiveRecord::StatementInvalidexceptions indicate that an error occurred at the database level, for example when a unique constraint is violated.
GuardClause, I think I’m getting it now. You just do early return as opposed to
- Apache Bench (
wrkcan be scripted with Lua.
bin/railsis the symlink.
- Rails startup is slow because of Rubygems and Bundler?
config.ruis used to determine that it is a Rack app.
- Rails slimming down – remove middleware,
- Controllers are Rack apps.
- Check test suites for Rails
- 30 mb lighter RAM for slim Rails.
- HTML minification on Cloudflare.
- HTML can’t be cached because CSRF token changes every time you reload the page.
- Chrome net-internals to check how long the SSL takes.