...when you come back to the console later Calls RSpec 1 (spec) in a Rails 2 project and RSpec 2 (rspec) in a Rails 3 project Configures RSpec to use...

I recently browsed through the ActiveSupport code and found some nice stuff I did not know about: ActiveSupport::Callbacks

objectmentor.com

What you can do today. Example AOP-isms in Ruby on Rails. Aspect-Oriented Design. The AOP Promise for Tomorrow...

gem 'guard', '=1.8.1' gem 'guard-livereload', '=1.4.0', :require => false Notes for Rails 2.3 projects On Rails 2.3, you need to add the middleware like this: # config/environments/development.rb

...that is set to true when in test mode: class ExampleController < BaseController SKIP_CAPTCHA = Rails.env.test? ... Next, depend activation of that feature on the value of that constant: private

...config.gem 'chunky_png', :version => '=0.8.0' create config/initializers/compass.rb (or copy from development repo): ^ require 'compass' rails_root = (defined?(Rails) ? Rails.root : RAILS_ROOT).to_s Compass.add_project_configuration(File.join(rails_root, "config...

^ This configuration file works with both the Compass command line tool and within Rails. Require any additional compass plugins here. project_type = :rails project_path = Compass::AppIntegration::Rails.root

When you use a belongs_to or has_many macro you might be surprised that the methods that it generates...

I recently noticed that better_errors allows you to to open files from within your favorite editor. However it was...

If an view spec crashes due to undefined helper methods, you can enable this option: # config/application.rb config.action_controller.include_all_helpers = true...

...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...

...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...

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...

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...

--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...

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

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...