"Unable to find associated Rails Model" warning

Just started using RM and loving it. Probable going to buy a few licences soon ;-)

There is one annoying thing: a lot of my models are in app/models sub folders to help keep everything organized. It seems like RM does not 'see' these files when it tries to validate the belongs_to / has_many associations. All my associations that are pointing to models in the root of the folder models dont have this issue.

Is there a way to config this so the warning goes away (and to have the Model dependency diagram works too).



Could you please provide small code sample with belongs_to association declaration?


Here is a screenshot. See, all associations are underlined and the corresponding files are in the same folder as the class Metric, they just happen to not be in the root Model folder. Associations to models that are in the root folder of Model dont have this issue.


Thank you for the issue! I've filed a bug youtrack.jetbrains.net/issue/RUBY-5936 and have already fixed it =)


How did you solve it?

I have the same problem in my project

Rubymine unable to find.jpg


I'm having the same issue after upgrading to RubyMine 5. My models are all directly in the app/models folder (no subdirectories).


HI there! So How do we solve this problem?  I'm having also this problem!


The problem went away for me when the Rails app is in the project root and not a subfolder under that.


Were you able to resolve this? I have this same problem. My models are all under app/models directly under the project root. It seems to resolve belongs_to correctly but the has_many is giving me this warning.


Actually, my problem was due to pluralization and I was able to resolve with an inflection rule.


In the file /config/initializers/inflections.rb I added a pluralization rule. This resolved my problem. The issue I had was with 'data' which is singular 'datum'. I had named everything with 'data' so i needed to add a rule like (where ModelData was the name of my model and model_data was the name of my table in mysql)

ActiveSupport::Inflector.inflections(:en) do |inflect|
  inflect.irregular 'model_data', model_data' # plural and singular are the same


Please sign in to leave a comment.