If you migrate a Rails application from Sprockets to Webpack(er), you can either transpile your CoffeeScript files to JavaScript...
If you use transactional_fixtures or the database_cleaner gem with strategy :transaction, after_commit callbacks will not be fired...
...polymorphic association. class Event < ApplicationRecord has_many :letters, as: :record end class Letter < ApplicationRecord belongs_to :record, polymorphic: true end event = Event.new.letters.build event.save! # => ActiveRecord::RecordInvalid: Validation failed: Record must exist...
...member', :home_page end It has some limitations: Only works for singular member references ("belongs to"), not for a collection of references ("has many") No support for deletion (but could...
...when you run a Selenium test with Capybara. This will help you understand "impossible" behavior of your tests. When you run a Rack::Test (non-Javascript) test with Capybara, there...
...you. But sometimes the complexity will bleed through, causing your tests to show "impossible" behavior. Here is some unexpected behavior caused by the interaction of threads and processes:
In Ruby you can communicate between processes with sockets. This might be helpful in tests that validate parallel executions or...
sudo gem install gettext --no-ri --no-rdoc sudo gem install fast_gettext --no-ri --no-rdoc script/plugin install git://...
...skipping asset compilation when assets have not changed? Turns out there is an even better way to speed up Capistrano deployments with asset compilation – and it's even simpler.
With cd .. you can navigate one directory up from the one you are at now. If you use that a...
Unpoly's [up-observe], [up-autosubmit] and [up-validate] as well as their programmatic variants up.observe() and up.autosubmit...
When your JavaScript bundle is so massive that you cannot load it all up front, I would recommend to load...
Capybara added a deprecation warning in version 3.35.3 (version from 2019) that shows up if your selector is not of...
After updating Rubygems you see a wall of deprecation warnings like this: NOTE: Gem::SourceIndex#add_spec is deprecated, use...
When storing files for lots of records in the server's file system, Carrierwave's default store_dir approach may...
If you are using scrum in a project you might be familiar with planning poker, a playful way to agree...
accepts_nested_attributes_for :children validates_associated :children end class Child < ApplicationRecord belongs_to :parent, inverse_of: :children end class Child::AsForm < ActiveType::Record[Child] change_association :parent...
...AsForm record with nested Child::AsForm records, the children will not be saved. This behavior also applies to the case where you override the association with has_many :children,...
...and...
This is a bookmarklet you can add to Chrome or Firefox which will allow you to create a story in...
By default, Devise redirects to a sign-in form when accessing a route that requires authentication. If for some reason...
Carrierwave includes some handy helper methods you can use to resize your images. Here is a quick summary of them...
# 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...
Within Capybara you most certainly use the #check- and #uncheck-method to (un)check checkboxes. But there's one problem...
RubyMine offers you to exclude directories from search, meaning faster search results and less "noise" in the list of result...
...issue with this pattern/approach. What's happening? Consider these classes: class Post < ActiveRecord::Base belongs_to :thread def thread_title thread.title end end class Thread < ActiveRecord::Base has_many :posts...
...post.thread is not actually a Thread even though looking at its class makes you believe so: post.thread.class => Thread Its real class is ActiveRecord::Associations::BelongsToAssociation which is sometimes exposed, for...