...a given set of values. The list of allowed values must be retrievable in order to render boxes. Each value has a humanized label. Sometimes there is a default value...
...can tune the threshold: Closer to 1.0 = stricter match Closer to 0.0 = looser match Ordering by best match User .where("similarity(name, ?) > 0.3", "John") .order(Arel.sql("similarity(name, 'John') DESC...
...method that is called after :store within the uploader and removes these files. In order to check, if the files are still there, you need to explicitly call my_legacy_version.retrieve_from...
...When using zeitwerk (Rails 6) you might also need to add an inflection in order to make autoloading work for this file: ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.acronym 'IO'
...to_sort_atoms on non-strings so you can define your own natural sort order. There is also natural_sort_by which works like Ruby's sort_by(&block).
...puppetdb_query( "resources [ parameters, title ]{ exported=true and type = 'Nagios_service' and parameters.ensure != 'absent' order by certname, title }" ) Then we join the queried services with our template file { '/etc/naemon/conf.d/services.cfg':
VCR lets you configure how it matches requests to recorded cassettes: In order to properly replay previously recorded requests, VCR must match new HTTP requests to a previously recorded one...
In order to have monitoring for Sidekiq (like queue sizes, last run of Sidekiq) your application should have a monitoring route which returns a json looking like this: { "sidekiq": {
...then returned as an array of responses: // This is batch request payload: { "requests": [ { "name": "order", "path": "/orders", "method": "POST", "body": { "address": "Home, 12345" } }, { "name": "order_item", "path": "/orders/{{ order.uuid }}/items...
"method": "POST", "body": { "title": "A Book" } }, { "name": "payment", "path": "/payments", "method": "POST", "body": { "orders": [ "{{ order.uuid }}" // <-- and here ] } } ] } // This is a possible response: [ { "name": "order", // <-- "order" part of "order.uuid" "status...
...Info and Size Including NEXT_DATA Inline CSS Info and Size Get your in order Event Processing Time Interaction Long Task Layout Shifts
...if page.find('.that-element') # Do something else # Never happens because #find raises end In order to simply check whether an element is present, without errors raised, you can use #has...
...are equivalent. Equivalency means: Whitespace is ignored Types of attribute quotes are irrelevant Attribute order is irrelevant Comments are ignored You use it like this: html = ... expect(html).to match...
# Options documented here: https://github.com/vkononov/compare-xml default_options = { collapse_whitespace: true, ignore_attr_order: true, ignore_comments: true, } options = default_options.merge(options).merge(verbose: true) diff = CompareXML.equivalent?(expected_doc, actual...
...to overwrite these methods or call the parent version with super depending in which order and in which way they were added to singleton class. Consider the following code:
When using ORDER BY "column" in PostgreSQL, NULL values will come last. When using ORDER BY "column" DESC, NULLs will come first. This is often not useful. Luckily, you can...
...tell PostgeSQL where you want your NULLs, by saying ... ORDER BY "column" DESC NULLS LAST ... ORDER BY "column" ASC NULLS FIRST Your indexes will have to specify this as well...
-# record/_form.haml = form_for record do |form| -# ... .form-actions yield(form) In order to make your template record/_form.haml accept a block when you render it, you can render...
When dealing with AR scopes, you can remove conditions, order, etc by using the unscope method. It is available on Rails 4+. Examples Consider an exemplary User class as follows...
...User < ActiveRecord::Base scope :active, -> { where(locked: false) } scope :admins, -> { where(role: 'admin') } scope :ordered, -> { order(:name) } end users = User.active.admins.ordered ^ SELECT "users".* FROM "users" WHERE "users"."locked" = 'f' AND "users...
...placeholder for the remote Rails root directory. # * Append ` || test $? =1;` to grep calls in order to avoid exit code 1 (= "nothing found") # * To be able to process the output with...
...can see sent mails in your browser when opening http://127.0.0.1:1080 Note: In order to see the emails in the MailCatcher interface and keep your cucumber features running, copy...
When an object is created / updated, various callbacks are executed in this order: before_validation after_validation before_save around_save before_create around_create after_create after_save
track down warnings and to see failing specs immediately or to get an overview of the core functionalities, you can use RSpec's "nested" format. It looks...
...model and maker should find tools by serial number Call RSpec like this in order to use the nested format: spec spec -f documentation
...this functionality/behavior and the value you assign will be translated one by one. In order to tell the SASS compiler that it should resolve the assigned value as variable, you...
...string values. Be careful when dealing with e.g. font-family definitions in variables. In order to preserve existing quotes, you may use the meta.inspect() function: @use "sass:meta"
...reverse_order does not work with complex sorting constraints and may even silently create malformed SQL for rails < 5. Take a look at this query which orders by the maximum...
...GREATEST(pages.published_from_de, pages.published_from_en) DESC').to_sql # => SELECT "pages".* FROM "pages" ORDER BY GREATEST(pages.published_from_de, pages.published_from_en) DESC Rails 4 Rails 4 will not...
...you're using one. Add this file to your config/initializers, it fixes the loading order issue but will only work for Rails >= 6: # fix_active_record_filter_attributes.rb # We're loading ActiveRecord before `filter_parameter_logging.rb...
...quality lie ahead. First, make sure your code is reliable: 1. Reliable code In order to reach the baseline for good code, make your code: deterministic tested (automated)