I am trying to find certain functions in the Rails api docs. For example, in the console I can type in:
ActiveRecord::Base.connection.tables
ActiveRecord::Base.connection.indexes("sometable")
and get a list of tables back and a list of indexes. I look in the Rails api doc,
but cannot find any reference to either of these.
I find connection() but the trail ends there! A little help figuring out the apis!
thanks…
ActiveRecord::Base#connection internally relies on ActiveRecord::Base.connection (class method) which return a concrete implementation of the ActiveRecord::ConnectionAdapters::AbstractAdapter class.
You should search the
#indexesmethod in your concrete adapter, for instance PostgreSQLAdapter#indexes.RDoc doesn’t provide any hint on the object type returned by a method call. You should dig into the source code or have a deep understanding of the package itself.
There are alternatives such as Yard which generates a much more complete API documentation.
There’s also the Rails Searchable API Doc Project which offers a searchable Rails API.
You can enter the method name and have a list of all objects implementing that method.