If a class depends on another class in this situation, it should
probably use an explicit require at the top of the file. Then you'll
just need to add the correct directories to the load path.

HOWEVER, unless you trust your users completely, you are headed down a
very bad path. For example, a single file with:

  User.delete_all

in it will hose your entire user system (assuming the model name is
User).
Even better, this will most likely crash your server:

  def fork_bomb
    fork { fork_bomb }
    fork { fork_bomb }
  end

  fork_bomb

[other examples involving spawning open telnet ports, ftp servers, and
other evils omitted]

Just exactly what are you trying to implement by having users upload
Ruby code?

--Matt Jones

On Mar 26, 11:43 pm, elioncho <[email protected]> wrote:
> Hello guys,
>
> In my app users are able to upload their own classes into their public
> folder and execute certain code on them. I have this code to load the
> classes on their folder:
>
> Dir.glob(File.join(path,self.login,'lib','*.rb')).each { |f| load(''+f
> +'') }
>
> This is actually loading the classes but not in the order it should.
> Sometimes some classes extends from other and therefore should be
> added later.
>
> So, I did a test and hardcoded the loads in order:
>
>     load 'public/.../lib/foo.rb'
>     load 'public/.../lib/bar.rb'
>
> and it worked. So my question is: How can I do to load all this
> classes without problems. For instance when I put the classes in the
> rails lib folder there are no problems loading them. What method does
> rails has to load the files on the lib folder? Any help is
> appreciated, thanks
>
> Elías
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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