Search code examples
ruby-on-railstwitter-bootstraprubymine

Cannot resolve file in RubyMine


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?

enter image description here


Solution

  • 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)