Switch from Milia to Apartment - keep data? - ruby-on-rails

We have a product that has been built using the milia multi-tenanting gem (https://github.com/jekuno/milia) . Unfortunately it seems this gem is dead. We can't upgrade past Rails 5 because of this.
Is there any way to move from milia to another gem (eg apartment https://github.com/influitive/apartment - though I see that hasn't been updated in 2 years either!) and not force everyone to recreate passwords etc?

I ended up modifying Milia to work with Rails 6.
That new gem is called Philia

Had the same issue trying gem milia had to use acts_as_tenant- which is well upto date and supports rails 5.2 upwards and its syntax close to gem 'acts_as_tenant'
https://github.com/ErwinM/acts_as_tenant

Related

How to use Apartment gem in Rails 7

Apartment gem is not working in Rails 6 and Rails 7 projects - it failes on undefined method `new' for "Apartment::Reloader.
Is there good way howto solve this problem? Or is there any good replacement of this gem? We need it for a new big project...
While SO is not the ideal platform for recommendations, I often find ruby-toolbox to be a good source:
https://www.ruby-toolbox.com/categories/Multitenancy
As I know, the apartment gem is no longer actively maintained by its owners and therefore has been forked into what is now known as ros-apartment gem. It works with Rails 6 as I have used it but yet try with Rails 7.
You can also use act_as_tenant gem which works fine with Rails 6 and 7.
The difference between the two is that ros-apartment uses a schema or database (depending on the database type) approach while act_as_tenant uses a row base.
The links below are the documentation sources for the gems
ros-apartment
act_as_tenant
You don't need the Apartment gem if working with rails 6/7 to implement multitenancy at the db level. Rails natively supports connection switching that can be used to implement this. See https://guides.rubyonrails.org/active_record_multiple_databases.html. If you want table level tenancy, then I believe acts_as_tenant works for this.
I have implemented the former on a project.

Alternative to i18n_routing gem that works with Rails 4?

After updating my Rails site to version 4 I got some serious problems with the i18n_routing gem - https://github.com/kwi/i18n_routing/issues/43 - it works fine with resource routes thanks to fixes in a fork, but named routes wont work.
So, the question is: does anyone know of a solid alternative to this gem that works with Rails 4?
Thanks!

Is there an updated rails_sql_views gem for rails 3.2?

I need the functionality provided by the rails_sql_views gem. However it looks like the last commit for this gem was made in 2010. Has this project been outdated by a new project? I'd like to find an active gem to use to get this functionality.
http://activewarehouse.rubyforge.org/rails_sql_views/
http://rubygems.org/gems/rails_sql_views
After further research here is a Rails 3 candidate for similar functionality:
https://github.com/bradphelan/Active-Illusion
This is a gem of this blog post:
http://xtargets.com/2011/08/02/tableless-views-with-active-record/
However this solution doesn't seem to be very popular.
schema_plus gem has create_view method that seems compatible (although I'm not familiar with rails_sql_views).
barancw, I needed this gem for our product using Rails 3.2.5, so I forked the repo and updated the necessary pieces. This gem is great for improving the performance of our large database queries, as it reduces the need to load objects into memory. I combined this gem with another optimization: Rails - given an array of Users - how to get a output of just emails?
https://github.com/ryanlitalien/rails_sql_views
Original documentation: http://rubydoc.info/gems/rails_sql_views/0.8.0/frames/index
Please keep in mind the docs are a bit outdated ("require_gem" has been replaced with "gem" and add the gem to your Gemfile as well).

Rails 3: Using a gem as my main app

I want to use the code of a gem as my main application code instead of just installing it with "bundle install".
How can I create an entire rails app based on a gem and using that gem as my app?
Thank you.
You are looking for Rails Engines instead I believe. If not, then can you explain your problem further?

cache_money for Rails 3

I've used various forks (mostly the ngmoco fork) of Nick Kallen's excellent cache_money for several Rails 2.3 based project, but we're now making the leap to Rails 3 which, thanks to the introduction of ActiveRelation, does not work with the popular forks of cache_money.
Is there a fork of cache_money, or an equivalent write-through cache, that is compatible with Rails 3 ?
Last week I launched a new write-through-cache gem for Rails 3, see https://github.com/orslumen/record-cache.
The reason I built it, is because we were using cache money and recently migrated to Rails 3. So chances are it may also serve you well.
There are a branch rails 3 in ngmoco fork to use you :
http://github.com/ngmoco/cache-money/tree/rails3
You can try it I don't know if it's really works.
You can add this in your Gemfile by
gem 'cache_money', :git => 'git://github.com/ngmoco/cache-money.git', :branch => 'rails3'
second_level_cache is also a gem inspired by CacheMoney.

Resources