问题
I am trying to use RubyMine (v6.3.3) for my rails project.
After I added bootstrap-sass
gem according its instruction
in https://github.com/twbs/bootstrap-sass, RubyMine complains about the line I added in application.js
file. However the file is actually in the scope of the projects' external libraries.
The project itself works as expected, just this RubyMine warning annoyed me.
Did I miss any step in configuration?
回答1:
It is confirmed to be a RubyMine issue.
bootstrap-sass
gem has added assets
to the assets path, and that's why the project works. https://github.com/twbs/bootstrap-sass/blob/master/lib/bootstrap-sass/engine.rb#L6
However RubyMine appeares to ignore the Rails.application.config.asset.paths
setting and only inspect the default asset paths. That's why the red wavy underline appears.
Here is the open issue for RubyMine: http://youtrack.jetbrains.com/issue/RUBY-15585
The workaround to this is to create a symbol link (vendor/assets -> assets) in your local gem installation. It will shut RubyMine up.
2.1.0/gems/bootstrap-sass-3.2.0.0% ls -l vendor
total 8
lrwxr-xr-x 1 gogao staff 9 Aug 7 11:28 assets -> ../assets
More details can be found in the GitHub issue https://github.com/twbs/bootstrap-sass/issues/684 (Thank you, @Ri4a)
回答2:
It's a problem with the bootstrap-sass
gem. See here: https://github.com/twbs/bootstrap-sass/issues/684
回答3:
Use //= require bootstrap-sprockets
instead of //= require bootstrap_sprockets
in application.js
回答4:
Same problem here, it seems that rubymine does not recognises the libraries stored in vendor/assets/components
. If you store your library in vendor/assets/javascripts
or in app/assets/javascripts
, it will be recognized by rubymine.
回答5:
I try many methods, but they don't work for me.
At last, I fixed it using a strange method:
- Quit RubyMine
- cd /path/your_rails_project
- rm -r .idea/
- Restart RubyMine and open your project
The related environment in my case:
RubyMine: 7.1
bootstrap-sass: 3.3.4
I hope this answer would save other guys' time.
来源:https://stackoverflow.com/questions/24646244/cannot-resolve-file-in-rubymine