Hi I have found the the below code in environment.rb Here used subdirectories to better organize files Dependencies.load_paths += [ File.join(RAILS_ROOT, "app/models/Dir1"), File.join(RAILS_ROOT, "app/models/Dir2") ] What I understood is Rails includes /app/models in the load_path automatically however it does not include subdirectories. Is it right? I would like to know there is a better way on handling that, either by generically loading all subdirectories or by having 1 file in the app/models directory load the files in the subdirectory Thanks in advance Sijo -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Peter De Berdt
2008-Dec-31 12:02 UTC
Re: automatically load subdirectories under app/models
On 31 Dec 2008, at 06:08, Sijo Kg wrote:> I have found the the below code in environment.rb Here used > subdirectories to better organize files > > Dependencies.load_paths += [ > File.join(RAILS_ROOT, "app/models/Dir1"), File.join(RAILS_ROOT, > "app/models/Dir2") > ] > > What I understood is Rails includes /app/models in the load_path > automatically however it does not include subdirectories. Is it > right? I > would like to know there is a better way on handling that, either by > generically loading all subdirectories or by having 1 file in the > app/models directory load the files in the subdirectoryThis would probably work: config.load_paths += Dir["#{RAILS_ROOT}/app/models/**/**"] Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Could you please tell here the difference between config.load_paths += Dir["#{RAILS_ROOT}/app/models/**/**"] and config.load_paths += Dir["#{RAILS_ROOT}/app/models/**"] Note ** Sijo -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Peter De Berdt
2009-Jan-02 11:26 UTC
Re: automatically load subdirectories under app/models
On 02 Jan 2009, at 09:42, Sijo Kg wrote:> Could you please tell here the difference between > config.load_paths += Dir["#{RAILS_ROOT}/app/models/**/**"]models and all subdirectories (even within a subdirectory)> and > > config.load_paths += Dir["#{RAILS_ROOT}/app/models/**"]models and subdirectories in models Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---