Thank you, jemminger.

That works for me now. However, I've got another issue. I have an
my_parse.rb file to parse an xml file. The directory for these files
is lib/myfiles/my_parse.rb, and lib/myfiles/xml/aa.xml. And also I
have a test file in test/unit/my_parse_test.rb. The error message is:
Errno::ENOENT: No such file or directory - xml/aa.xml when I put the
path to the aa.xml flie like this - xml/aa.xml in my_parse_test.rb.
But, it is OK if the aa.xml is in the same dir as my_parse.rb is with
the path - aa.xml.
So, what is the right path to the aa.xml in my_parse.rb if I put
aa.xml file in xml/aa.xml?
(like this: lib/myfiles/my_parse.rb, and lib/myfiles/xml/aa.xml)



On Nov 12, 2:55 pm, jemminger <[EMAIL PROTECTED]> wrote:
> you can have as many subdirectories in lib or anywhere else you want.
> you will just have to explicitly require those files or write
> something to auto-require the files in those dirs.
>
> e.g. if you make "lib/myfiles/foo.rb", you'll have to put "require
> 'myfiles/foo.rb'" to use it
>
> On Nov 12, 1:41 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > I may not want to have a directory of files anywhere that much but,
> > what if I want to separate my *rb files from *xml files? The case I am
> > having now is that I have to put all my own files in a signal lib
> > directory which I may not like it very much. Is this ture that I
> > cannot have a sub directory in lib?
>
> > On Nov 12, 8:13 am, jemminger <[EMAIL PROTECTED]> wrote:
>
> > > The lib directory is included by rails automatically, so any file in
> > > there will be included.  If you put it elsewhere you'll have to
> > > specifically require them yourself.
>
> > > On Nov 11, 11:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > Thank you for the response.
>
> > > > I am practicing on v1.7 and it works fine. But, if I move the code
> > > > from components to comp dir in lib, the controller can not fine those
> > > > fine any more. If I put those files in lib directly, it woks fine
> > > > again. How can I maintain a structure of directories in Rails?
>
> > > > Thanks,
>
> > > > -
>
> > > > On Nov 11, 4:15 pm, jemminger <[EMAIL PROTECTED]> wrote:
>
> > > > > the "components" dir is deprecated and removed in v2.0+ AFAIK
>
> > > > > you'd be better off using the lib dir or making a plugin.
>
> > > > > On Nov 11, 1:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > > > wrote:
>
> > > > > > All,
>
> > > > > > This is the first time to play on Rails application. Simple 
> > > > > > questions:
> > > > > > where to locate/store my own *.rb, and *.txt files in my Rails app?
> > > > > > I put my *.rb in the components folder so that controllers can see
> > > > > > them without problems. Is this the right place to do that?
> > > > > > But I may not know where to put *.txt files and how to locate them 
> > > > > > in
> > > > > > controllers.
>
> > > > > > Thank you in advance.
> > > > > > -- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to