commontator
commontator copied to clipboard
Rails 7 - Generated models and my own custom changes aren't applying.
I run rake commontator:copy:models and make changes to the validation rules inside model in app/models/commontator/comment.rb but they don't apply, like the documentation says it should.
I am trying to remove the validation for uniqueness on comment body. If there was a way to do this with a config flag, I also wouldnt need to copy out the model and change it, although it would be nice to still be able to update the models.
If you are in dev mode, did you remember to restart the server after copying the file? It's possible something changed in Rails 7 and broke this feature though, since I know they changed how they load files.
yeah I definitely tried that and it didn't work. I also tried generating a brand new project on latest rails and Ruby and still no luck unfortunately. Looks like it is an issue with rails 7.
I ended up forking and modifying the model myself for the short term until a better solution is available.
got the same issue, for comments_controller
try add this line to your application.rb
Commontator::Engine.config.autoload_once_paths = []
or
Commontator::Engine.config.autoload_once_paths.delete_if{|s| s.match? /models/}
@musik it seems the first option worked for me. The README should probably be updated to reflect this.
try add this line to your application.rb
Commontator::Engine.config.autoload_once_paths = []
orCommontator::Engine.config.autoload_once_paths.delete_if{|s| s.match? /models/}
This worked for me Thank you