If your postgres database is only accessible from inside a kubernetes cluster, e.g. if it's configured in AWS RDS...
This card shows you how to center a float horizontally in CSS. Also: find out what techniques are available for...
For performance improvements (and to remove the need for eager loading), the ActsAsTaggableOn gem supports caching your tag lists directly...
We recently migrated a Rails application from yarn to npm. We decided to go this step instead of upgrading to...
...lot of logic and callbacks for a particular form screen, but then the model becomes a pain in tests, where all those callbacks just get in the way. Or we...
...have different forms for the same model but they need to behave very differently (e.g. admin user form vs. public sign up form). There are many approaches that promise help...
When accepting GIF images, you will also accept animated GIFs. Resizing them can be a time-consuming task and will...
...API (notable methods and properties) video = document.querySelector('video') video.play() video.pause() video.load() // Reset to the beginning and select the best available source video.currentSrc // The selected source video.currentTime // The current playback time...
Canonical does not ship Ubuntu 24.04+ Vagrant images due to HashiCorps switch to the Business Source License (BSL). There is...
To run additional code before an existing Rake tasks you can add a dependency like this: task :before_task...
These steps are now part of Spreewald. Here are some useful examples how to use the attached Cucumber Timecop steps...
...willy@astor.de" And I follow "Cancel account" Then I should see "Account canceled" By going beyond the single line descriptions we've accustomed to, we can provide all the information that...
...file_inside' do let(:path) { '/opt/invoices/' } it 'should send a requested file that lives beneath the given directory' do subject.should_receive(:send_file).with('/opt/invoices/123.pdf', {}) subject.send :send_file_inside, path...
To set a cookie in your test browser for cucumber tests, you need to know which driver you are using...
Disclaimer This card is a collection of guides and things to have in mind when upgrading to a specific version...
Put the attached file into features/support/. Example usage: When /^I open the task named "(.+?)"$/ do |task_name| task = page.all('.task...
If you need to make an HTTPS connection to a host which uses an expired certificate, do not disable certificate...
When you use a belongs_to or has_many macro you might be surprised that the methods that it generates does not override a method with the same name. Take...
class Project < ActiveRecord::Base def user "foo" end belongs_to :user end Project.new.user still returns "foo". The reason for this is that what belongs_to does is actually...
Recent IRB versions include a multi-line autocomplete which may be helpful to novice users but can be distracting.
...existing bash script to work for commits that are referencing Linear IDs. A core benefit of our convention to prefix commits by their corresponding issue ID is that we can...
...easily detect commits that belong to the same issue. You can either do that manually or use the bash script below. It can either be placed in your .bashrc or...
If you want to exclude your staging site from Google using robots.txt without running the risk to forget deleting the...
...is a fix to SafeBuffer#gsub. Note that it will only fix the $1 behavior, not give you a safe string in the end (see below). Example def test(input...
...really expect outside code (read: Gems) to not use $1 (and there is plenty, believe me) when calling gsub on an input that may be a SafeBuffer, you need to...
Here is how to start your Rails application to accept both HTTP and HTTPS in development. gem install passenger
...reject_if: :all_blank # Ignore the blank template record end class Image < ActiveRecord::Base belongs_to :gallery mount_uploader :teh_image, YourUploaderHere # Mount Carrierwave on attribute :teh_image end
...to automatically fix the whitespace, see below. (Note that this might lead to unexpected behaviour e.g. in Markdown documents.) The global git hooks live in $PREFIX/share/git-core/templates/hooks (where $PREFIX is probably...