Chris Seelus


60 Experience
0 Lessons Completed
0 Questions Solved


Posted in Recurring events with the ice_cube gem Discussion

Thanks Chris, very helpful as always :-)

As RecurringSelect.is_valid_rule?('null') is true, I had to change the recurring=(value) method.

Posted in Active Storage (Rails 5.2) vs Shrine

If you need to validate your files, for example validate that only certain file types be uploaded or that some file size constraints (no files bigger than X megabytes) are adhered to, use Shrine.

Also Active Storage currently has no way to retain uploads between form redisplays. So for example if a User uploads a 20MB video to your site and the form needs to get redisplayed because the User has forgotten to input a Video title or some other validation fails, the Video is gone.

There are many other features Active Storage currently lacks, like data URI uploads.

The missing validations and no way to retain uploads on form redisplays make Active Storage more of a toy in comparision with Shrine at the moment. If you can live without those features though, go for Active Storage, as its much simpler to set up.

Posted in Build Multitenancy App in a different way

We have implemented a multitenancy app with the Acts As Tenant gem ( and Devise, where a User can have Memberships in multiple Organizations. Users eligible for managing other Users (you my call them Admins) can 'invite' Users from other Organizations to join, so that they can switch between those Organizations. No subdomains used.

Essentially a User has_many Memberships (and Organizations through Memberships). An Organization has_many Memberships (and Users through Memberships). And a Membership belongs_to an Organization and User.

No (offical) way to use validations ( for Active Storage yet. Mayor bummer …

Here is a solution that works with Rails 5.2.0:

  form.hidden_field :image, value: form.object.image.signed_id if form.object.image.attached?
  form.file_field :image
Nice Episode, as always.

How does one retain an upload if the form redisplays, say if you have validation error on one of the attributes of the form model? Shrine has a Plugin for that, is there something you could do to make caching work with Active Storage?