Sunday, September 23, 2012

Re: [Rails] Re: Why is this simple require failing?

>>That's because most of the time when you require something, it is a gem,
>>and gems are installed in specific directories that ruby searches when

I think you misunderstood, I am saying I've never seen:

require './folder/file'

I ALWAYS see:

require 'folder/file'

For example: 



I just don't understand why mine isn't working the same way?  Did cancan add something to the load path somewhere?


On Sun, Sep 23, 2012 at 6:50 PM, 7stud -- <lists@ruby-forum.com> wrote:
> I've never seen that require in any gems on the web

That's because most of the time when you require something, it is a gem,
and gems are installed in specific directories that ruby searches when
you require something.  You can see a list of the directories ruby
searches when you require something by doing this:


p $LOAD_PATH

If one of those directories isn't your current directory, and you want
to require a file in your current directory, then your require has to
specify the path(absolute or relative) to the file.

require './your_file.rb'

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate