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

0
13 comments

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

0
Avatar
Permanently deleted user

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

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

0
Avatar
Permanently deleted user

Thx.

0
Avatar
Permanently deleted user

How did you solve it?

I have the same problem in my project


Rubymine unable to find.jpg

0
Avatar
Permanently deleted user

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

0
Avatar
Permanently deleted user

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

0
Avatar
Permanently deleted user

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

0
Avatar
Permanently deleted user

thanks! it works!!

0
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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


0
Avatar
Permanently deleted user

inflection rule? what's dat?

0
Avatar
Permanently deleted user

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.