commontator icon indicating copy to clipboard operation
commontator copied to clipboard

Rails 7 - Generated models and my own custom changes aren't applying.

Open alaarab opened this issue 2 years ago • 7 comments

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.

alaarab avatar Apr 25 '22 05:04 alaarab

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.

alaarab avatar Apr 25 '22 06:04 alaarab

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.

Dantemss avatar Apr 26 '22 15:04 Dantemss

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.

alaarab avatar Apr 26 '22 17:04 alaarab

got the same issue, for comments_controller

zebleck avatar Jul 20 '22 22:07 zebleck

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 avatar Aug 30 '22 10:08 musik

@musik it seems the first option worked for me. The README should probably be updated to reflect this.

alaarab avatar Nov 02 '22 00:11 alaarab

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/}

This worked for me Thank you

BBVishalkumar avatar Oct 09 '23 12:10 BBVishalkumar