...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...
Don't insert table rows in a Rails database migration. This will break tests that expect that database to be empty and cause you all sorts of pain.
config.action_controller.action_on_unpermitted_parameters enables logging or raising an exception if parameters that are not explicitly permitted are found. Set to :log or :raise to enable. The default...
...value is :log in development and test environments, and false in all other environments. Rails 3: If you include the strong_params gem, see the Readme for handling unpermitted keys...
This card shows how to get a Ruby method touch_device? for your Rails views and a method TouchDevice.isPresent() for your Javascripts. Note that we are detecting touch devices...
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...
...this on the top of your config/schedule.rb: job_type :runner, "cd :path && bundle exec rails runner -e :environment ':task' :output...
...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
If your Rails application is using Webpack you need to serve assets on the same host as you application runs, otherwise you will see the following errors in your browser...
...in all needed sizes, formats and with the HTML needed to include them! In Rails applications with Haml: put all the favicon files into /public store the HTML to app/views/layouts/_favicon.html...