List all Models, Controllers, Views and Tests

Hi All,

List all Models, Controllers, Views and Tests

I am writing a plug
in and I need to list all the models and their related controllers, views and any
unit test scripts for models, functional test scripts for controllers and
integration test scripts for views.

How would I be able
to get this information and display it using Rails?

Kind Regards

Gurdipe

Hello

in ur app, get models

Dir[‘app/models/.rb’].map {|f| File.basename(f, '.’).camelize.constantize }
def get_model_names_sub
Module.constants.select do |constant_name|
constant = eval constant_name
if not constant.nil? and constant.is_a? Class and constant.superclass == ActiveRecord::Base
constant
end
end
end

Hi Rogerio,

Thanks for the awesome
brilliant reply, it’s been a great help to me.

Gurdipe