Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No entities found; create your models first!" #6

Closed
reedlaw opened this issue Feb 21, 2011 · 9 comments
Closed

"No entities found; create your models first!" #6

reedlaw opened this issue Feb 21, 2011 · 9 comments

Comments

@reedlaw
Copy link

reedlaw commented Feb 21, 2011

I'm using rails-erd 0.4.3 in a Rails 3.0.4 app with Ruby 1.8.7 and when I run rake erd or rake erd filetype=dot in the Rails root directory I get the following error:

Loading code in search of Active Record models...
Generating Entity-Relationship Diagram for 0 models...
rake aborted!
No entities found; create your models first!

It says I have 0 models but running ls -1 app/models/ | wc -l gives me a result of 48.

@rolftimmermans
Copy link
Member

Thank you for reporting this. Rails ERD eager loads your Rails application's environment. It relies on Rails to do this properly. There might be something off with the configuration.

Could you please try the following? In your Rails app, type "rails console" to start an interactive Rails session. Now enter "Rails.application.config.eager_load_paths". This should return the paths that are automatically loaded by Rails, and therefore by Rails ERD. Could you post these paths?

@reedlaw
Copy link
Author

reedlaw commented Feb 22, 2011

Here are the results:

[~/sb/ampms] git:next $ rails c
Loading development environment (Rails 3.0.4)
ruby-1.8.7-p302 > Rails.application.config.eager_load_paths
 => ["/Users/reed/sb/ampms/app/controllers", "/Users/reed/sb/ampms/app/helpers", "/Users/reed/sb/ampms/app/models"]

@ylansegal
Copy link

Hey, first of all, thanks for rails-erd, I find the diagrams really useful!

I have the same problemas the OP, but it used to work fine for me.
Here is my output:

Loading application environment...
Loading code in search of Active Record models...
Generating Entity-Relationship Diagram for 0 models...
rake aborted!
No entities found; create your models first!

I did some git bisect magic to find the commit that broke the functionality and it turns out that the problem seems to be a conflict with the 'kaminari" gem. As soon as I add "gem Kaminari" to my Gemfile, rake erd doesn't find any models.

Here is a link to the gem in question:
https://github.com/amatsuda/kaminari

I hope this helps!

@reedlaw
Copy link
Author

reedlaw commented Feb 24, 2011

Thanks! That did the trick. I had that gem bundled but without it rails-erd works flawlessly.

@ylansegal
Copy link

Any idea on how to have my cake and eat it too? I want kaminari, but I also want rails-erd!

@rolftimmermans
Copy link
Member

Thank you for your detective work! It turns out this is a problem with Kaminari.

I have opened a pull request (https://github.com/amatsuda/kaminari/pull/34); let's hope it gets merged quickly. I will keep this issue open until a fixed version of Kaminari is released, in case other people come across the same problem.

@rolftimmermans
Copy link
Member

Kaminari has been fixed as of version 0.10.4! It should now play nice with Rails ERD and other gems that depend on ActiveRecord::Base.descandants.

Thank you both for reporting this problem and your help in solving it!

amatsuda/kaminari@cb65a17

@reedlaw
Copy link
Author

reedlaw commented Feb 24, 2011

Thanks for fixing this!

@ylansegal
Copy link

Hey, that did the trick for me as well. Amazing turn around time rolftimmermans (and also amatsuda)!

Thanks.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants