Closed imtayadeway closed 5 years ago
Apparently I only use my mode in the rails applications, that's why I've never experienced this issue.
Thank you for raising it.
But looking at your change I'm not sure if it's correct. Firstly projectile-rails-root
is a function not a variable so it should raise an error. And to be honest, the most straightforward way for accomplish that should be:
@@ -1627,8 +1627,7 @@ If file does not exist and ASK in not nil it will ask user to proceed."
(projectile-rails-set-assets-dirs)
(projectile-rails-set-fixture-dirs)))
-(dolist (mode '(ruby-mode-hook enh-ruby-mode-hook))
- (add-hook mode #'projectile-rails-expand-snippet-maybe))
+(add-hook 'projectile-rails-mode #'projectile-rails-expand-snippet-maybe)
I can't recall why I haven't do it that way. I have re-test this change and see if it works.
@asok thanks for looking that over. Apparently I don't write much lisp these days, so thanks for spotting that. I updated with your suggestion - LMK if you need any other changes
Now my elisp is rusty. It should be (add-hook 'projectile-rails-mode-hook #'projectile-rails-expand-snippet-maybe)
. That is 'projectile-rails-mode-hook
instead of 'projectile-rails-mode
.
@asok ah thanks for checking! Amended and force-pushed
Thanks!
While most of these do not apply, I'm finding the
require "rails_helper"
in the spec skeleton a bit jarring when I'm creating spec files in non-Rails Ruby projects. Granted, this snippet allows me to specify which helper getsrequire
'd, but I think I'd rather have a hook that gave me good defaults for non-Rails projects when I'm not in one, and this feels like the wrong place to introduce nuances like that.