Forum: Ruby on Rails Modelist gem now helps find path between ActiveRecord models and search by name/table/assoc/column

8838005371ab9c0b1d40f0504bf8832a?d=identicon&s=25 Gary Weaver (garysweaver)
on 2013-06-28 15:58
(Received via mailing list)
We have a complex legacy schema with a lot of tables and models, and I
can't keep all of the paths between tables in my head, so just wrote
something that could help find the path between any two models just by
entering their model names like:

bundle exec modelist paths my_model_1 my_model_2

which results in (greatly simplified because a full actual response is
much, much longer):

checking for path from foobar to barfoo...

Paths from foobar to barfoo (2): -> foo.barfoos -> barfoo

foobar.barfoo -> barfoo

(shortest path last)


bundle exec modelist search partial_search_string

results in:

  Foo (table: foos)
  Foobar (table: foobars)
  Bar (table: bars), association: foo (macro: belongs_to, options: {})
  Loo (table: loos), association: f_users (macro: has_one, options:

Check it out and please report issues in github and do PR's for fixes:

It is a little messy at the moment, but it seems to be working ok for
unless I'm missing something.

Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.