...README for the carrierwave gem Read about Common mistakes when storing file uploads with Rails Carrierwave: How to attach files in tests Carrierwave: Built-in RSpec matchers CarrierWave: Processing images...

Use gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.2.x-lts' # for Rails 2.x gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.3.x-lts' # for Rails...

...we still recommend the solution in this card. If you need to synchronize multiple rails processes, you need some shared resource that can be used as a mutex. One option...

...notably, it allows you to represent data in a very readable manner. For example, Rails offers a compact DSL to define new routes. A big drawback however is that your...

...pass your string or stream directly. >> Attachment.create!(file: FileIO.new(contents, 'document.pdf')) => # When using zeitwerk (Rails 6) you might also need to add an inflection in order to make autoloading work...

...allows you to log to multiple sinks. You know this behavior from from the rails server command, that both logs to standard out and the log/development.log file.

...development.log file. Here is an example for Sidekiq: Sidekiq.configure_client do |config| if ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test' stdout_logger = ActiveSupport::Logger.new(STDOUT) file_logger = ActiveSupport::Logger.new...

makandra Curriculum

Watch Solving bizarre authorization requirements with Rails Read the Consul README Read the assignable_values README Understand how Consul and assignable_values can be used to implement arbitrary authorization...

...INFO -- : [53a240c1-489e-4936-bbeb-d6f77284cf38] more Goal When searching through Rails logs on production, it's often hard to see all lines that belong to the same requests, since...

...et dolore magna aliqua. Mi eget mauris pharetra et ultrices neque." output_mp3_path = Rails.root.join("tts/ipsum.mp3") new Synthesizer(input_text, output_mp3_path).to_mp3 Code require "ruby-openai"

Webpack is the future. We're using it in our latest Rails applications. For tests, we want to compile assets like for production. For parallel tests, we want to avoid...

...Dir.empty?(public_output_path) end delegate :public_output_path, to: :config private def test? Rails.env.test? end def parallel_tests? test? && !!parallel_tests_number end def parallel_tests_number

...saved to database directly as the the dumped object was not marked dirty, thus rails does not see the need to save it, even if the object is not present...

When using Rails to truncate strings, you may end up with strings that are still too long for their container or are not as long as they could be. You...

Adopting legacy Rails apps Talk to your mentor about how we're approaching applications that are either old or abandoned by a different team earlier: Add E2E tests for the...

Rails' ActiveSupport::TimeWithZone objects have both a timezone code and offset, e.g. Thu, 28 Mar 2019 16:00:00 CET +01:00. Ruby's stdlib TZInfo also has time zones...

...chances are you'll end up in the wrong time zone. This is why Rails actually uses a long list of time zone names with have names like "London" or...

Here is how to start your Rails application to accept both HTTP and HTTPS in development. gem install passenger Create a self-signed SSL certificate. Store the generated files in...

getbootstrap.com

...use SimpleForm in your project, I would suggest to regenerate the configuration file with rails generate simple_form:install --bootstrap and merge it with your own customizations instead of only...

...version "3.4.0" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.0.tgz#8de513fa0fa4b2c7d2e48a530e26f0596936efdf" integrity sha512-ggRCXln9zEqv6OqAGXFEcshF5dSBvCkzj6Gm2gzuR5fWawaX8t7cxKVkkygKODrDAzKdoYw3l/e3pm3vlT4IbQ== package.json { "dependencies": { "@rails/webpacker": "4.x", "bootstrap-datepicker": "1.8.0", # the package says it needs "jquery": ">=1.7.1 <4.0.0" as a dependency

...node_modules/jquery node_modules/bootstrap-datepicker/node_modules/jquery Actual issue Within the Rails Webpacker config we now provide a jQuery object to boostrap-datepicker: config/webpack/environment.js environment.plugins.prepend( 'Provide', new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery...

...partial_double_verification. This might be handy in case you are testing helpers in Rails, where you sometimes rely on methods defined in the application controller (e.g. current_user and...

When you are using PgBouncer with e.g. a Ruby on Rails application which uses different application_names for the PostgreSQL connection (for Puma, Sidekiq, Cronjobs, ...) PgBouncer will set the application...

apidock.com

...an instance of its subclasses or superclass. This is useful because some parts of Rails reflect on the class of an instance, e.g. to decide which partial to render:

Large Rails projects tend to define multiple custom ways to format Dates or DateTimes. This often leads to duplicated format strings, wrong formats and unnecessary introduction of new formats.

...application server without configuration Usage Install Passenger Standalone with gem install passenger Inside any Rails project, start Passenger Standalone with passenger start Alternatives You can use Puma. It also supports...

} start your server as usual, but go to https://localhost:3000 bundle exec rails s Accept the certificate in your browser See also Creating a self-signed certificate for...

...deployed to the servers. The gems of these groups might not be loaded by rails, however, the deployment process will take longer as the gems will be downloaded and installed...