rails_wordpress
rails_wordpress copied to clipboard
Fix Rails 5.2 incompatibility
Following my comment on PR #3, I propose this change to fix the error raised on app loading with Rails 5.2 :
NoMethodError: undefined method `sqlite3=' for ActiveRecord::Base:Class
.../rails_wordpress/lib/rails_wordpress/railtie.rb:9
My opinion is that the gem should not change the belongs_to_required_by_default
config of its parent application. In my company, we use rails_wordpress
as a Rails engine in a larger app, with another database and other models living aside. They should not be concerned by this setting. So I suggest to replace this global config by individual optional: true
on every belongs_to
association declaration (as suggested by @brijeshror himself in his initial PR #3). I added a test on creating a Post without parent.
I also update the Rails locked dependency (used in tests) to latest 5.2 version.
It would be good if this could get sorted out as we are trying to use this under Rails 5.2 as well.