Migrating from Devise to Rodauth, Rspec

If you want to read about migrating a basic Rails application from Devise to Rodauth, go to Basics. Removing Devise When writing controller or feature tests, you usually have a file in spec/support/devise.rb. It includes Devise test helpers, you can use sign_in @user in your RSpec tests. You can remove the file entirely: - RSpec.configure do |config| - config.include Devise::Test::ControllerHelpers, type: :controller - config.include Devise::Test::ControllerHelpers, type: :view - end Updating the specs Sadly, Rodauth doesn’t have an easy helper for the tests and recommends performing the authentication through the normal requests....

April 19, 2025 · Codefabrik GmbH

Migrating from Devise to Rodauth, Basics

Devise has been my go-to authentication library for as long as I can remember. Recently, though, I had requirements that were incompatible with Devise. Namely, to allow authentication both from a HTML frontend via session cookies, and via JWT from a mobile app. Apparently, Rodauth supports that use case and many more. This post explains the minimal steps to migrate from Devise to Rodauth in a Rails application, while the other posts of the series explain advanced topics when special Devise features were in use....

April 19, 2025 · Codefabrik GmbH

How to use Propshaft with Rails 8

How to use Propshaft with Rails 8 Recently, the first beta version of Rails 8 has been released, and with it, Propshaft has become the default asset pipeline. Propshaft works quite differently to Sprockets. Mainly, all compilation, minification und concatenation tasks are outsourced to separate gems. The asset pipeline itself is only responsible for loading the assets and fingerprinting them, so they can be cached indefinitely. By default, Propshaft is configured to serve assets from app/assets, lib/assets and vendor/assets....

October 1, 2024 · Codefabrik GmbH

Migrating Rails 6 applications from webpacker to importmaps

Rails 7 will no longer ship with webpacker by default but will instead use importmaps. This is a much lighter solution for applications which mostly rely on external scripts. This post explains how to migrate an existing application from webpacker to importmaps. Installation Remove the webpacker gem from your Gemfile and add the importmap-rails gem instead. Next, remove the javascript_pack_tag line from your application layout in app/views/layouts/application.html.erb. To set everything up, run the importmap installer with the command ....

October 14, 2021 · Codefabrik GmbH

ActiveRecord::StrictLoadingViolationError for ActionText::RichText

This blog posts explains how to get rid of the StrictLoadingViolationError when using ActionText. ...

December 14, 2020 · Codefabrik GmbH

Undefined method `name' for nil:NilClass in AddServiceNameToActiveStorageBlobs

This blog posts explains how to get rid of the Undefined method error when migration ActiveStorage from Rails 6.0 to 6.1. ...

December 14, 2020 · Codefabrik GmbH

DRY up controllers with autoloader

Have you ever had the feeling that you were repeating yourself when writing controller code for your Rails app? You were right, because you actually did! See this example of a basic posts controller in a blog application PostsController < ActionController::Base def index @posts = Post.all end def show @post = Post.find(params[:id]) end def new @post = Post.new end def create Post.create(params[:post]) end def destroy post = Post.find(params[:id]) post.destroy end end Every controller that is tied to an ActiveRecord-model has more or less this structure....

October 25, 2013 · Codefabrik GmbH