Hi, I would like to add some models to a sub folder under /app/models/. It seems that these are not loaded automatically. Do I need to specify this new sub folder path somewhere? I tried adding it to environment.rb, but no luck: config.load_paths += %W( {RAILS_ROOT}/app/models/external ) Any help would be much appreciated. Thanks, GiantCranes -- 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 -~----------~----~----~----~------~----~------~--~---
Sure, add the following to the Rails::Initializer block in config/environment.rb: config.load_paths += Dir["#{RAILS_ROOT}/app/models/*/"] Hope this helps, GiantCranes -- 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 -~----------~----~----~----~------~----~------~--~---
Giant Cranes wrote:> Sure, add the following to the Rails::Initializer block in > config/environment.rb: > > config.load_paths += Dir["#{RAILS_ROOT}/app/models/*/"] > > Hope this helps, > GiantCranesThanks. -- 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 -~----------~----~----~----~------~----~------~--~---
Giant Cranes wrote:> Giant Cranes wrote: >> Sure, add the following to the Rails::Initializer block in >> config/environment.rb: >> >> config.load_paths += Dir["#{RAILS_ROOT}/app/models/*/"] >> >> Hope this helps, >> GiantCranes > > Thanks.Hi, I need to do the same thing, but only with my views. I tried: config.load_paths += Dir["#{RAILS_ROOT}/app/views/users/*/"] but no luck. Do I have to do something different when defining the action in the controller? Ideally, I''d like to have something like: tld.tld/users/favorites/appetizers/(user_id). Is there something additional I need to do, or is it even possible? Thanks! Dave -- 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 -~----------~----~----~----~------~----~------~--~---
Dave, If you want to group controllers you can do so like this # /app/controllers/admin/users_controller.rb class Admin::UsersController < ApplicationController end # /app/controllers/admin/images_controller.rb class Admin::ImagesController < ApplicationController end Both those controllers are then prefixed by ''admin'' (.com/admin/users and .com/admin/images) and look for their views inside of /app/views/ admin. However for what you''re wanting to do I would look into RESTful routes. In app/config/routes.rb you can map resources (controllers) like so: map.resources :users, :path_prefix => "admin" (available at .com/admin/ users) the path prefix can be as long as you want, and if you want to get really crazy you do things like this: map.resources :users do |user| user.resources :images end then you could have a url like .com/users/9/images/4 peepcode.com have a screencast on RESTful Rails it''s well worth spending the $9 on it. hope that helps! - Alastair On Feb 19, 8:30 pm, "Dave A." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Giant Cranes wrote: > > Giant Cranes wrote: > >> Sure, add the following to the Rails::Initializer block in > >> config/environment.rb: > > >> config.load_paths += Dir["#{RAILS_ROOT}/app/models/*/"] > > >> Hope this helps, > >> GiantCranes > > > Thanks. > > Hi, I need to do the same thing, but only with my views. I tried: > > config.load_paths += Dir["#{RAILS_ROOT}/app/views/users/*/"] > > but no luck. Do I have to do something different when defining the > action in the controller? Ideally, I''d like to have something like: > tld.tld/users/favorites/appetizers/(user_id). > > Is there something additional I need to do, or is it even possible? > > Thanks! > > Dave > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---