Controllers Take care when defining nested resources, as they don't behave identical to namespaced resources: namespace :users do resources :sign_ups, only: [:new] end # GET /users/sign_ups/new...

...in controllers/sign_ups_controller.rb in order to make the second example work. You can alter this behaviour with a custom controller path, as shown in the very first example of this card...

chrisboakes.com

Debouncing a method call delays its execution until after a specified time has passed. If it's called again before...

web.archive.org

Rails 6.1 has a "strict loading" mode that forces the developer to preload any association they plan to use. Associations...

github.com

Zeitwerk is the new autoloader of Rails. It is mandatory starting with Rails 7.0. Sometimes, a model needs to know...

The tree command will show you the contents of a directory and all its sub directories as a tree:

This should not be necessary in any case and is only for special cases, for e.g. if the assets...

makandra dev

...is no longer established using sudo per default. Databases created for local development usually belong to the local user an therefore do not need to be accessed using sudo...

Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home: Install mysql-sandbox...

sudo gem install gettext --no-ri --no-rdoc sudo gem install fast_gettext --no-ri --no-rdoc script/plugin install git://...

Rails has the handy controller method send_file which lets us download files easily. We can decide whether the file...

Ruby methods which load from a Yaml file, like YAML.safe_load or YAML.safe_load_file, support passing freeze: true to...

With this command you can run all the spec files which have been edited or added in the current branch...

selenium.dev

...Chrome for Testing if none is found on the system. I worked around this behavior by setting the path to the binary in the selenium initializer Capybara.register_driver :selenium do...

github.com

...spawns another process to run a browser, it will inherit the environment and also believe it lives in that zone. To do so, run the following code before your test...

A severe bug was found in ImageMagick by Bryan Gonzalez from Ocelot Team. It allows to embed the content of...

If you want to move a complete commit from one repository to another (and you don't want to add...

Added: State machine can now use the :prefix-option to avoid name collision if you define multiple state machines on...

github.com

When a method has keyword arguments, Ruby offers implicit conversion of a Hash argument into keyword arguments. This conversion is...

Use option:checked to find the currently selected option: select.querySelector('option:checked') Yes, :checked, not :selected. This is the same...

Carrierwave includes some handy helper methods you can use to resize your images. Here is a quick summary of them...

...applications with forms (warp_params will do that for you). But maybe its a better idea to stick to a standard that client libraries know to handle. Tests

...really nice and we implemented it in a similar way like here. In the beginning we tried to remove any duplicated in the schema files. So when a booking had...

kb.wisc.edu

When receiving a new SSL-Certificate for an existing SSL-key it should be checked that they match cryptographically.

# Capitalized expressions are intended to be replaced with YOUR values describe 'SERVICE', -> beforeEach -> module 'MODULE' module ($urlRouterProvider) -> # Prevent uiRouter's initialization, i.e. do not sync the current URL...

When a controller action redirects to an external URL (like http://somehost.com/some/path) you will find that this is hard...