I recently noticed that better_errors allows you to to open files from within your favorite editor. However it was not so easy to get rubymine:// links to work on...
...Does xdg-open "rubymine:///etc/hosts" open the hosts-file in RubyMine? Step 4: Tell better_errors to use your opener The BETTER_ERRORS_EDITOR_URL environment variable can be used...
To use a form model with devise, you can simply override #resource_class in a controller. A typical use case...
Using Capistrano, we usually have some array configurations in the config/deploy.rb file, like set :linked_files, %w[config/database.yml], so in...
Talking with APIs makes more fun using Postman. As an alternative you can also use command line tools like cURL...
Element finding is a central feature of Capybara. Since #find is normally used to get elements from the current page...
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...
Using Ruby 1.8.7 you will not be able to use the maximum versions Rubygems 1.8.30 and Bundler 1.17.3 with https://...
This decision tree describes how to use the alt attribute of the element in various situations. For some types of...
Note Using rem only ever makes sense when the root font size is dynamic, i.e. you leave control to the...
When you need to find out in which kind of spec you are during run-time, it's definitely possible...
So you added a new callback to your model that (e.g.) caches some data when it is saved. Now you...
This should not be necessary in any case and is only for special cases, for e.g. if the assets...
Regular expressions in Javascript are represented by a RegExp object. There also is a regex literal as in many other...
When you do a bitwise copy using the dd tool you will not see any output until it completes or...
If you update Selenium regularly, you'll run into deprecation warnings similar to: WARN Selenium [:clear_local_storage] [DEPRECATION] clear...
RSpec lets you define the arguments with which you expect a method to be invoked: subject.should_receive(:say).with('hello...
...optional on association declarations with a symbol, lambda or proc. Explanation Association declarations like belongs_to support the option optional. This option does not support symbols, lambdas or procs. If...
...the presence of the associated object won't be validated. Example Bad class Note belongs_to :owner, optional: :draft? end note = Note.new(state: 'created', owner: nil) note.valid? # => true Good
sudo gem install gettext --no-ri --no-rdoc sudo gem install fast_gettext --no-ri --no-rdoc script/plugin install git://...
...by doing date on the shell. E.g. our main application servers are running on Berlin (CEST) time, but this will differ on other machines. Rails also assumes that datetime fields...
...Rails 2, open config/environment.rb and comment or remove the config.time_zone line: # config.time_zone = 'Berlin' In order to disable time zone conversion in Rails 3 or newer, open config/application.rb and...
It's quite confusing how many external displays are usable with a MacBook that uses an M1 or M2 Chip...
...many :taggings, dependent: :destroy + has_many :posts, through: :taggings +end app/models/tagging.rb +class Tagging < ApplicationRecord + belongs_to :post + belongs_to :tag + + validates :post, uniqueness: { scope: :tag } +end app/controllers/posts_controller.rb def post_params...
...many :taggings, dependent: :destroy + has_many :posts, through: :taggings +end app/models/tagging.rb +class Tagging < ApplicationRecord + belongs_to :post + belongs_to :tag + + validates :post, uniqueness: { scope: :tag } +end app/controllers/posts_controller.rb def new
When testing your command line application with Aruba, you might need to stub out other binaries you don't want...
...applications is to make the observe frequency low enough that out-of-order responses become unlikely enough. Try to poll the query field for changes every 0.75 seconds or longer...
If a Cucumber run deletes your application directory, an integration fail between Capybara and Capybara Screenshot may be the cause...