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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.