Is there a simple way to obtain the full path of the Rails application root directory from the Rails application? (The parent dir of the apps,public, etc. directories) Thanks in advance, Don McClean --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> Is there a simple way to obtain the full path of the Rails application > root directory from the Rails application? > (The parent dir of the apps,public, etc. directories)The RAILS_ROOT constant. However this will most likely be a relative path, but you can use File.expand_path to make it absolute. -philip> > Thanks in advance, > Don McClean > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks! On Mar 15, 12:40 pm, Philip Hallstrom <r...-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote:> > Is there a simple way to obtain the full path of the Rails application > > root directory from the Rails application? > > (The parent dir of the apps,public, etc. directories) > > The RAILS_ROOT constant. > > However this will most likely be a relative path, but you can use > File.expand_path to make it absolute. > > -philip > > > > > Thanks in advance, > > Don McClean--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''m relatively new to Unix. Is there a problem with using the relative path vs. the absolute? I''d just like to be clearer on that ''cause I sometimes see just RAILS_ROOT and sometimes the File.expand_path. I''m no fan of the cargo cult so I''ve just stuck with using RAILS_ROOT. ;) RSL On 3/15/07, Don.Mc <Don.McClean-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Thanks! > > On Mar 15, 12:40 pm, Philip Hallstrom <r...-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote: > > > Is there a simple way to obtain the full path of the Rails application > > > root directory from the Rails application? > > > (The parent dir of the apps,public, etc. directories) > > > > The RAILS_ROOT constant. > > > > However this will most likely be a relative path, but you can use > > File.expand_path to make it absolute. > > > > -philip > > > > > > > > > Thanks in advance, > > > Don McClean > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> I''m relatively new to Unix. Is there a problem with using the relative path > vs. the absolute? I''d just like to be clearer on that ''cause I sometimes see > just RAILS_ROOT and sometimes the File.expand_path. I''m no fan of the cargo > cult so I''ve just stuck with using RAILS_ROOT. ;)I don''t think so... maybe in some cases where you have some shared code and want to test the path to set a variable... of some sort... in that case you''d want the full path to test with.> > RSL > > On 3/15/07, Don.Mc <Don.McClean-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >> Thanks! >> >> On Mar 15, 12:40 pm, Philip Hallstrom <r...-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote: >>>> Is there a simple way to obtain the full path of the Rails application >>>> root directory from the Rails application? >>>> (The parent dir of the apps,public, etc. directories) >>> >>> The RAILS_ROOT constant. >>> >>> However this will most likely be a relative path, but you can use >>> File.expand_path to make it absolute. >>> >>> -philip >>> >>> >>> >>>> Thanks in advance, >>>> Don McClean >> >> >>> >> > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks! On 3/16/07, Philip Hallstrom <rails-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote:> > > > I''m relatively new to Unix. Is there a problem with using the relative > path > > vs. the absolute? I''d just like to be clearer on that ''cause I sometimes > see > > just RAILS_ROOT and sometimes the File.expand_path. I''m no fan of the > cargo > > cult so I''ve just stuck with using RAILS_ROOT. ;) > > I don''t think so... maybe in some cases where you have some shared code > and want to test the path to set a variable... of some sort... in that > case you''d want the full path to test with. > > > > > RSL > > > > On 3/15/07, Don.Mc <Don.McClean-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > >> > >> Thanks! > >> > >> On Mar 15, 12:40 pm, Philip Hallstrom <r...-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote: > >>>> Is there a simple way to obtain the full path of the Rails > application > >>>> root directory from the Rails application? > >>>> (The parent dir of the apps,public, etc. directories) > >>> > >>> The RAILS_ROOT constant. > >>> > >>> However this will most likely be a relative path, but you can use > >>> File.expand_path to make it absolute. > >>> > >>> -philip > >>> > >>> > >>> > >>>> Thanks in advance, > >>>> Don McClean > >> > >> > >>> > >> > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
There can be a problem with relative vs absolute path when it comes to #require: require ''./../lib/file'' vs require ''/home/user/site/lib/file'' Doing both will actually require the file twice, as Ruby caches according to the string given. While this is a rare case, it can lead to a lot of debugging time if you don''t realize this, so be careful. Jason On 3/16/07, Russell Norris <sconds-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Thanks! > > On 3/16/07, Philip Hallstrom <rails-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote: > > > > > > > I''m relatively new to Unix. Is there a problem with using the relative > > path > > > vs. the absolute? I''d just like to be clearer on that ''cause I > > sometimes see > > > just RAILS_ROOT and sometimes the File.expand_path. I''m no fan of the > > cargo > > > cult so I''ve just stuck with using RAILS_ROOT. ;) > > > > I don''t think so... maybe in some cases where you have some shared code > > and want to test the path to set a variable... of some sort... in that > > case you''d want the full path to test with. > > > > > > > > RSL > > > > > > On 3/15/07, Don.Mc <Don.McClean-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> > > >> > > >> Thanks! > > >> > > >> On Mar 15, 12:40 pm, Philip Hallstrom <r...-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote: > > >>>> Is there a simple way to obtain the full path of the Rails > > application > > >>>> root directory from the Rails application? > > >>>> (The parent dir of the apps,public, etc. directories) > > >>> > > >>> The RAILS_ROOT constant. > > >>> > > >>> However this will most likely be a relative path, but you can use > > >>> File.expand_path to make it absolute. > > >>> > > >>> -philip > > >>> > > >>> > > >>> > > >>>> Thanks in advance, > > >>>> Don McClean > > >> > > >> > > >>> > > >> > > > > > > > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---