When you have many changes, and you want to spread them across different commits, here is a way to stage...
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 making cross-domain AJAX requests with jQuery (using CORS or xdomain or similar), you will run into issues with...
When a controller action redirects to an external URL (like http://somehost.com/some/path) you will find that this is hard...
Rails comes with grouped_collection_select that appears to be useful, but isn't. As an alternative, consider the flat...
...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...
...being used by default (which may be annoying). Here is how to do that. Beware: By following the steps below, you will drop and recreate your cluster. You will lose...
...As an example, we will be modifying 9.5 main (running on port 5435) below. Become a PostgreSQL superuser sudo su postgres Backup entire database pg_dumpall -p 5435 > 5435.sql
CoffeeScript and JavaScript (ECMAScript) both have operators in and of. Each language use them for more than one purpose. There...
When such a virtual attribute should contain integer values you might get unexpected behavior with forms, because every param is a string and you don't get the magic...
...guest from the CD, open a terminal (on the guest, not the host!) and become root: sudo su fdisk -l to see the disk information. \ There should be one drive...
Two weeks ago, Cloudflare was struck by a global outage that lasted ~30 minutes. The incident was rooted on a...
...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...
If you use transactional_fixtures or the database_cleaner gem with strategy :transaction, after_commit callbacks will not be fired...
If you migrate a Rails application from Sprockets to Webpack(er), you can either transpile your CoffeeScript files to JavaScript...
...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...
This note describes how to kick a user out of a Rails application after she hasn't requested an action...
tl;dr: Use event.currentTarget unless you are absolutely certain that you need event.target. Since it hasn't been written down...
...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.
...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:
After updating Rubygems you see a wall of deprecation warnings like this: NOTE: Gem::SourceIndex#add_spec is deprecated, use...
...should see the following ([\w]+) table:?$/ do |name, expected_table| name = name.underscore table_element = begin element_at("table\##{name}") rescue Webrat::NotFoundError begin element_at("table.#{name}") rescue element_at...
...a "add new user" forms. Chrome developers say this is by design as they believe it encourages users to store more complex passwords. Recommended fix for Chrome and Firefox
When your JavaScript bundle is so massive that you cannot load it all up front, I would recommend to load...