...Whenever generated tasks for: some-app_staging 34 23 * * * /bin/bash -l -c 'cd /var/www/some-app_staging/releases/20201215171150 && RAILS_ENV=staging bundle exec rake some-task' # End Whenever generated tasks for: some-app_staging...

# Begin Whenever generated tasks for: /var/www/some-app_staging/releases/20201215171150 34 23 * * * /bin/bash -l -c 'cd /var/www/some-app_staging/releases/20201215171150 && RAILS_ENV=staging bundle exec rake some-task' # End Whenever generated tasks for: /var/www/some-app_staging/releases/20201215171150 # Begin Whenever...

...put it into app/util and configured application.rb like that: # catches 'invalid %-encoding' error require "#{Rails.root}/app/util/exception_app" config.middleware.insert_before Rack::Runtime, ExceptionApp::Middleware Note: Rails 4.2+ raises an ActionController::BadRequest error...

makandra dev

...which includes all webpack config options set for the current environment: const { environment } = require('@rails/webpacker') const webpack = require('webpack') throw JSON.stringify(environment, null, 2) ... Option 2: Browser console

...Resume script execution" to jump to the your set breakpoint Option 3: Node console $ RAILS_ENV=development node const config = require('./config/webpack/development') Option 4: Printing warnings const process = require('process...

--require spec_helper If you are on rspec >= 3 and use a rails_helper.rb require this instead of the spec_helper: --require rails_helper If you are using parallel...

makandra dev

You can significantly improve performance by adding this to config/initializers/better_errors: if defined?(BetterErrors) && Rails.env.development? module BetterErrorsHugeInspectWarning def inspect_value(obj) inspected = obj.inspect if inspected.size > 20_000 inspected = "Object was...

On your credit card summary, you will find order numbers of rides with Deutsche Bahn ("DB BAHN A-NR XYZ123...

...disable it in tests, by adding a body class for tests %body{'data-environment' => Rails.env} overriding the transforms [data-environment="test"] * text-transform: none !important

makandracards.com

Added an example and removed the redundant before_destroy.

makandra dev

Consul no longer uses ActiveSupport::Memoizable because that's deprecated in newer Railses. Consul now uses Memoizer for this. Temporarily change the current power When you set Power.current...

Instead of running all missing migrations on your test database with rake db:migrate RAILS_ENV=test you can also use a handful of rake tasks to prepare the database...

or use rake db:test:clone_structure ← preferred :) or use rake db:migrate RAILS_ENV=test and don't mix it with other ways, like some of the rake...

stackoverflow.com

mysql> SELECT @@global.version; +------------------+ | @@global.version | +------------------+ | 5.6.30 | +------------------+ 1 row in set (0,00 sec) MySQL 5.6 Reference Manual says "BLOB and TEXT...

...remote log files' task :logs do on roles :app do logfile = ENV['LOG'] || fetch(:rails_env) execute %(tail -n0 -F #{shared_path}/log/#{logfile}.log | while read line; do echo...

weblog.raganwald.com

For all of my professed admiration of Ruby on rails, I personally don't think that easier and more productive CRUD application writing will shake things up. I personally care...

...very much about writing applications in a tenth of the time, but using Rails is like listening to Jaco Pastorius. The real learning experience comes when you try to duplicate...

github.com

The ancestry gem allows you to easily use tree structures in your Rails application. There is one somewhat unobvious pitfall to it: its way of applying the orphan_strategy which...

...More than twice the amount of courses is probably not sensible, booting up rails takes its time, too...

Today I needed to execute a ruby gem executable with sudo. But, surprisingly, bash would tell me command not found...

ActiveSupport's memoize has a dangerous feature you might not know about. Assume you have class DeepThought extend ActiveSupport::Memoizable...

Cucumber_rails' old-school web-steps have been deprecated for a while, urging developers to write high-level step definitions that directly use Capybara or Webrat. We think that's...

...user symbol in the hash of inclusions turned into a "user" string.\ This breaks Rails' loading of associations as it will complain about calling nil.name or nil.macro while it tries...

The tagged_with scope comes with many awesome options to modify your search: User.tagged_with("awesome", "cool") # Users that are...

The cookies object in your controllers and views is a ActionController::CookieJar and even though that class inherits from Hash...

makandra dev

This is about converting Haml to ERB and not the other way round which you probably want! This process can...

ActiveRecord translations live in locale.activerecord. ActiveModel translations live in locale.activemodel. To use the same translations for both, use YAML references...

While RSpec 1 and 2 decided that specs inside spec/model are model specs, and those inside spec/features are feature specs...