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...
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...
...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...
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.
...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"
} 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...
...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:
...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...
...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...
...method's source code If your Gemfile comes with method_source (a dependency of Rails 7+), you can can inspect the source code directly using the Method#source method:
...also use Cookies with cURL. For easily making HTTP requests in an IRB or Rails console, take a look at the HTTP gem. If you prefer a GUI, take a...
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
...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...
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...
...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...
%span Reference %pre ~ content Reference Hello World Textareas In some versions of Haml + Rails, this may also be an issue for textarea elements. Fix it similarly: # Indented description
...for example, you maintain a gem and want to run automated tests against multiple rails versions. When you need to bundle one of your secondary Gemfiles, the solution above is...
...So might fix this by adding the following lines to your application.rb: class Application < Rails::Application config.time_zone = 'Berlin' # or whatever your time zone end It seems Date.yesterday uses the...
...add the following tests to test suites: # Make sure to require the previews Dir[Rails.root.join('spec/mailers/previews/*.rb')].each { |file| require(file) } ActionMailer::Preview.all.index_with(&:emails).each do |preview, mails|
...animated GIFs. Resizing them can be a time-consuming task and will block a Rails worker until the image is processed. Save yourself that trouble, and simply tell ImageMagick to...
where html_content can be replaced by one of the following commands: Rails body or response.body Capybara: page.driver.html.content page.body Webrat: Nokogiri::HTML(response.body).content The returned strings can...
...need to configure this if you're using system tests with modern versions of Rails. They do exactly the same
...you really want to manage Example One example is used by us in environments::railscomplete::dbcollector: $vhost_types = ['\'Environments::Elixir::Vhost\'', '\'Environments::Rails::Vhost\'', '\'Environments::Php::Vhost\'', '\'Environments::Python::Vhost...
...query("resources {type in ${vhost_types} and parameters.dbbackend = '${dbbackend}'}") $vhosts.each |$vhost| { ensure_resource('environments::railscomplete::db', $vhost['parameters']['dbuser'], { 'password' => $vhost['parameters']['dbpassword'], 'type' => $type, 'extensions' => $vhost['parameters']['dbextensions'], 'schemas...