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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
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):

foobar.foo -> foo.barfoos -> barfoo

foobar.barfoo -> barfoo

(shortest path last)

and:

bundle exec modelist search partial_search_string

results in:

Models:
  Foo (table: foos)
  Foobar (table: foobars)
Associations:
  Bar (table: bars), association: foo (macro: belongs_to, options: {})
  Loo (table: loos), association: f_users (macro: has_one, options:
{:foreign_key=>:foo_id})

Check it out and please report issues in github and do PR's for fixes:
https://github.com/garysweaver/modelist/

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

Gary
This topic is locked and can not be replied to.