Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alaarab opened this issue Apr 25, 2022 · 7 comments
Open

Comments

@alaarab
Copy link

alaarab commented Apr 25, 2022

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
Copy link
Author

alaarab commented Apr 25, 2022

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.

@Dantemss
Copy link
Member

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.

@alaarab
Copy link
Author

alaarab commented Apr 26, 2022

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.

@zebleck
Copy link

zebleck commented Jul 20, 2022

got the same issue, for comments_controller

@musik
Copy link

musik commented Aug 30, 2022

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

@alaarab
Copy link
Author

alaarab commented Nov 2, 2022

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

@BBVishalkumar
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants