Re: [Rails] List all Models, Controllers, Views and Tests
Hi Rogerio,
Thanks for the awesome brilliant reply, it's been a great help to me.
Gurdipe
On 7 April 2012 02:38, Rogerio Medeiros <argerim@gmail.com> wrote:
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--
2012/4/6 Gurdipe Dosanjh <rhomobileapps@gmail.com>
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
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/pKL5k9z3e3cJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
att,
Rogerio
A complicação se descomplica na mesma proporção que fazemos os nós se desatarem ao tecer o conhecimento do saber.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home