a little more perspective

0 views
Skip to first unread message

FredO

unread,
Jun 11, 2008, 7:13:02 PM6/11/08
to pdxruby
I am trying to develop a rails application in netbeans. And I am
trying to make use of the Rails Date Kit.

There is a date_helper.rb that I am to drop into Helpers/.
And there is a date_validator.rb that I am to drop into lib/

Under netbeans' directory structure for a rails project there is no
lib/. Where would be a good place to put it?

How does a ruby program know where to look when it encounters a
directive like "require 'date_validator'".?

Temporarily I have put date_validator.rb in Helpers/, and the when
running some test code, it seems to be picked up. Now for the next
issue. When I try to run the test code it get the following error
message:

/home/fredo/NetBeansProjects/RailsApplication1/app/helpers/
date_validator.rb:94: uninitialized constant ActiveRecord (NameError)
from /home/fredo/NetBeansProjects/RailsApplication1/test/unit/
deck_parser_test.rb:9:in `require'

I would assume that netbeans' would have have included in it's
development environment, the infrastructure to allow the jruby
interpreter to find ActiveRecord. But evidentially it is not.

Can someone clue me in to the larger picture?


Bryan

unread,
Jun 11, 2008, 7:56:05 PM6/11/08
to pdx...@googlegroups.com
Strange, NetBeans has a lib directory (called "Libs") for me.  Are you using JRuby/Glassfish?  I think a glassfish directory layout for Rails is a bit different than normal, but it should still have a lib or lib-equivalent directory.

You can add more directories and name them whatever you want though.  Then you have to indicate in your environment somewhere that the loadpath should include those directories (actually, I think they automatically get included if they're under the app directory, unless they're a subdirectory, such as app/models/subdir, but I might be wrong).

Jason LaPier

unread,
Jun 12, 2008, 9:49:56 AM6/12/08
to pdx...@googlegroups.com
I also see Libs in NetBeans. But aside from that, can't you just
navigate to /home/fredo/NetBeansProjects/RailsApplication1/lib and
drop the file there (e.g. using 'Finder', if you're using OS X)?

- Jason L.

--
My Rails and Linux Blog: http://offtheline.net

Reply all
Reply to author
Forward
0 new messages