Closed AmShaegar13 closed 1 year ago
Yes :user
should be optional. Lets do that separate from this PR and add a test for it.
Done.
Were you planning to create a separate PR to add optional: true
to :user
association?
Closing this as I've merged #36 which modifies this approach slightly.
Currently, the gem is loaded right away and requires active_record. When this happens, the database configuration is required even to run basic tasks like
assets:precompile
on a build host, which is suboptimal. There are two possible ways to prevent that:Set
require: false
for theactive_snapshot
gem in Gemfile and add an initializer that lazy loads it:gem 'active_snapshot', '~> 0.3.0', require: false
However, this will make the user required for a snapshot. I don't know why exactly but it looks like this is a bug anyway. In Rails 7,
belongs_to
will always add a presence validation. When lazy loading the gem, this actually works so the user is not optional anymore.active_record' to
test_helper.rb`.