"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).

Thx.

13 comments
Comment actions Permalink

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

0
Comment actions Permalink

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.



Attachment(s):
ss.GIF
0
Comment actions Permalink

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

0
Comment actions Permalink

How did you solve it?

I have the same problem in my project


Rubymine unable to find.jpg

0
Comment actions Permalink

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

0
Comment actions Permalink

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

0
Comment actions Permalink

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

0
Comment actions Permalink

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.

0
Comment actions Permalink

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


0
Comment actions Permalink

inflection rule? what's dat?

0
Comment actions Permalink

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
end

0

Please sign in to leave a comment.