end end def allowed_mime_types %w(image/jpeg image/png) end end This will behave like the solution before: User#portrait will get an expected error message and the User...
A general overview about why and how we migrate can be found under Migrating from Elasticsearch to Opensearch
...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...
...changes it for the current repository. Since it's hard to remember which project behaves how, you should find a suitable global setting. Regardless which option you use you can...
...current branch. Caveat with current For most of us, current is the safest push behavior. However, it has a small side effect: When a branch with your local name does...
In Capistrano 3, your Capfile requires 'capistrano/rails/migrations', which brings two Capistrano tasks: deploy:migrate and deploy:migrating. The former checks...
When MySQL refuses to use your index, there's a number of things that you may be doing wrong. One...
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...
Integration tests give the code its rough form, whereas unit tests pinpoint specific behavior. During development, you are frequently changing levels. It may look something like this: Integration _ ___
...usage example, "happy path"> # Add a scenario for each use case. Examples are: error behavior, access rights, contexts, closer looks at parts of the feature Scenario: ... (This example uses Cucumber...
This is a small example on how you can check if your Postgres index can be used by a specific...
While it might be tempting to set it per project (other devs might benefit from it), you need to do it each time for every project "pollute" a project...
It is just not worth the risk and you can always do better. Alternatives Instead, you should take a different approach. Here are several alternatives.
Note The maintenance mode is enabled on all application server as soon as the file /public/system/maintenance.html is present. Installation
There are different kind of memory measurement metrics in Linux. These are the differences: Code Name Description vsz virtual memory...
...rough setting (e.g. open Photos with Shotwell Viewer). If a certain file type (or better mime type) should be opened with a different application, this can be set via command...
...to determine if a service can be restarted or not. To manipulate the default behaviour, the package policy-rcd-declarative-allow-all or policy-rcd-declarative-deny-all can be...
...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...
There are several tools for DNS debugging which offer you more or less information. Most of the time the more...
Why do we migrate? Due to a change in licensing, we cannot provide Elasticsearch versions >= 8.0. Version 7.17.x will...
...for all exceptions (previously true) :none: It will raise for all exceptions (previous default behavior, value false) Using the new default needs to change a RSpec test like this:
Learn to treat files as an ActiveRecord attribute type, like :string or :integer Research Look at the README for...
...instead of using a more costing feature spec. This is especially useful because they become quite convenient when used with Capybara::Node::Finders and Capybara::RSpecMatchers. This allows to wirte...
...view might be too isolated, since view-specs will mock a lot of rails behavior and render the view independent from the controller-logic. Therefore it will be more applicable...
This still relies on params[:id] existing, so your code should reflect that: # Better User.find(params.expect(:id)) # Or User.find(params.require(:id)) Avoiding issues with extra parameters Rails logs extra...
...should still use permit (or expect) to receive Strong Parameters, but strip extra parameters. # Better (option 1) redirect_to users_path(params.slice(:query, :encoding).permit(:query, :encoding)) # Better (option...
available for button, fieldset, input, select, textarea, command, keygen, optgroup, option Browser specific behavior: IE 11: text inputs that are descendants of a disabled fieldset appear disabled but the...
Deep dive Okay, so the example above has at least one obvious benefit: You do not have to put self.table_name_prefix = "universe_" into each of your classes...
...it. It's not read at all. Here is why (follow links for a better understanding): An ActiveRecord class will pick the table_name_prefix of any of its module...